[cxx-interop] Make sure to use the cannonical base class type.

This commit is contained in:
zoecarver
2022-03-03 15:34:31 -08:00
parent f93bc6431d
commit cc08a3124b
3 changed files with 20 additions and 3 deletions

View File

@@ -338,7 +338,9 @@ namespace {
if (auto cxxRecord = dyn_cast<clang::CXXRecordDecl>(ClangDecl)) {
for (auto base : cxxRecord->bases()) {
auto baseRecord = cast<clang::RecordType>(base.getType())->getDecl();
auto baseType = base.getType().getCanonicalType();
auto baseRecord = cast<clang::RecordType>(baseType)->getDecl();
auto baseCxxRecord = cast<clang::CXXRecordDecl>(baseRecord);
if (baseCxxRecord->isEmpty())
@@ -346,8 +348,8 @@ namespace {
auto offset = layout.getBaseClassOffset(baseCxxRecord);
auto size =
ClangDecl->getASTContext().getTypeSizeInChars(base.getType());
fn(base.getType(), offset, size);
ClangDecl->getASTContext().getTypeSizeInChars(baseType);
fn(baseType, offset, size);
}
}
}