@@ -1325,6 +1325,8 @@ void GetDatamembers(TCppScope_t scope, std::vector<TCppScope_t>& datamembers) {
1325
1325
1326
1326
if (auto * CXXRD = llvm::dyn_cast_or_null<CXXRecordDecl>(D)) {
1327
1327
getSema ().ForceDeclarationOfImplicitMembers (CXXRD);
1328
+ if (CXXRD->hasDefinition ())
1329
+ CXXRD = CXXRD->getDefinition ();
1328
1330
1329
1331
llvm::SmallVector<RecordDecl::decl_iterator, 2 > stack_begin;
1330
1332
llvm::SmallVector<RecordDecl::decl_iterator, 2 > stack_end;
@@ -1445,7 +1447,7 @@ intptr_t GetVariableOffset(compat::Interpreter& I, Decl* D,
1445
1447
}
1446
1448
offset += C.toCharUnitsFromBits (C.getFieldOffset (FD)).getQuantity ();
1447
1449
}
1448
- if (BaseCXXRD && BaseCXXRD != FieldParentRecordDecl) {
1450
+ if (BaseCXXRD && BaseCXXRD != FieldParentRecordDecl-> getCanonicalDecl () ) {
1449
1451
// FieldDecl FD belongs to some class C, but the base class BaseCXXRD is
1450
1452
// not C. That means BaseCXXRD derives from C. Offset needs to be
1451
1453
// calculated for Derived class
@@ -1474,7 +1476,7 @@ intptr_t GetVariableOffset(compat::Interpreter& I, Decl* D,
1474
1476
}
1475
1477
if (auto * RD = llvm::dyn_cast<CXXRecordDecl>(FieldParentRecordDecl)) {
1476
1478
// add in the offsets for the (multi level) base classes
1477
- while (BaseCXXRD != RD) {
1479
+ while (BaseCXXRD != RD-> getCanonicalDecl () ) {
1478
1480
CXXRecordDecl* Parent = direction.at (RD);
1479
1481
offset +=
1480
1482
C.getASTRecordLayout (Parent).getBaseClassOffset (RD).getQuantity ();
0 commit comments