aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGClass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r--clang/lib/CodeGen/CGClass.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index e9a92ae..10e4543 100644
--- a/clang/lib/CodeGen/CGClass.cpp
+++ b/clang/lib/CodeGen/CGClass.cpp
@@ -1408,13 +1408,10 @@ FieldHasTrivialDestructorBody(ASTContext &Context,
{
QualType FieldBaseElementType = Context.getBaseElementType(Field->getType());
- const RecordType *RT = FieldBaseElementType->getAs<RecordType>();
- if (!RT)
+ auto *FieldClassDecl = FieldBaseElementType->getAsCXXRecordDecl();
+ if (!FieldClassDecl)
return true;
- auto *FieldClassDecl =
- cast<CXXRecordDecl>(RT->getOriginalDecl())->getDefinitionOrSelf();
-
// The destructor for an implicit anonymous union member is never invoked.
if (FieldClassDecl->isUnion() && FieldClassDecl->isAnonymousStructOrUnion())
return true;
@@ -2850,13 +2847,10 @@ void CodeGenFunction::EmitVTablePtrCheckForCast(QualType T, Address Derived,
if (!getLangOpts().CPlusPlus)
return;
- auto *ClassTy = T->getAs<RecordType>();
- if (!ClassTy)
+ const auto *ClassDecl = T->getAsCXXRecordDecl();
+ if (!ClassDecl)
return;
- const auto *ClassDecl =
- cast<CXXRecordDecl>(ClassTy->getOriginalDecl())->getDefinitionOrSelf();
-
if (!ClassDecl->isCompleteDefinition() || !ClassDecl->isDynamicClass())
return;