[PATCH] D143334: [clang][Interp] Fix diagnosing uninitialized ctor record arrays

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 14 21:57:03 PDT 2023


shafik added inline comments.


================
Comment at: clang/lib/AST/Interp/Interp.cpp:390
 
-  if (isa<RecordType>(ElemType.getTypePtr())) {
+  if (ElemType->isRecordType()) {
     const Record *R = BasePtr.getElemRecord();
----------------
aaron.ballman wrote:
> The difference between these two is that `isRecordType()` is looking at the canonical type whereas `isa<>` is looking at the type under inspection rather than the canonical type. I'd expect these to have the same behavior in most cases, but only matter for cases involving typedefs.
> 
> I think you're correct about the test case below not needing these particular changes -- at least, I'm not seeing what's changed that should impact the test. Should this be split into two changes? 1) Expose the test, 2) Make this functional change + add a new test where the canonical type is different to demonstrate the fix.
+1


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143334/new/

https://reviews.llvm.org/D143334



More information about the cfe-commits mailing list