Skip to content

Commit 3117f18

Browse files
tbaederryuxuanchen1997
authored andcommitted
[clang][Interp][NFC] Fix getting the record decl from a pointer type
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60250745
1 parent 8b11e95 commit 3117f18

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/AST/Interp/Compiler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5281,8 +5281,8 @@ template <class Emitter>
52815281
unsigned Compiler<Emitter>::collectBaseOffset(const QualType BaseType,
52825282
const QualType DerivedType) {
52835283
const auto extractRecordDecl = [](QualType Ty) -> const CXXRecordDecl * {
5284-
if (const auto *PT = dyn_cast<PointerType>(Ty))
5285-
return PT->getPointeeType()->getAsCXXRecordDecl();
5284+
if (const auto *R = Ty->getPointeeCXXRecordDecl())
5285+
return R;
52865286
return Ty->getAsCXXRecordDecl();
52875287
};
52885288
const CXXRecordDecl *BaseDecl = extractRecordDecl(BaseType);

0 commit comments

Comments
 (0)