diff options
Diffstat (limited to 'clang/lib/CodeGen/CGBlocks.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index 74d92ef0..597127ab 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -420,14 +420,11 @@ static void addBlockLayout(CharUnits align, CharUnits size, /// Determines if the given type is safe for constant capture in C++. static bool isSafeForCXXConstantCapture(QualType type) { - const RecordType *recordType = - type->getBaseElementTypeUnsafe()->getAs<RecordType>(); + const auto *record = type->getBaseElementTypeUnsafe()->getAsCXXRecordDecl(); // Only records can be unsafe. - if (!recordType) return true; - - const auto *record = - cast<CXXRecordDecl>(recordType->getOriginalDecl())->getDefinitionOrSelf(); + if (!record) + return true; // Maintain semantics for classes with non-trivial dtors or copy ctors. if (!record->hasTrivialDestructor()) return false; |