]> granicus.if.org Git - clang/commitdiff
Fixed checking for trivial destructor in CFGBuilder::addLocalScopeForVarDecl. Checked...
authorMarcin Swiderski <marcin.sfider@gmail.com>
Fri, 1 Oct 2010 00:31:22 +0000 (00:31 +0000)
committerMarcin Swiderski <marcin.sfider@gmail.com>
Fri, 1 Oct 2010 00:31:22 +0000 (00:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115254 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CFG.cpp

index a4e24f8b9f9116874f040ee5ee92e856211ca3c5..33e0ff94c2440935b2b1fb1007acfc2fb0c8c052 100644 (file)
@@ -564,9 +564,10 @@ LocalScope* CFGBuilder::addLocalScopeForVarDecl(VarDecl* VD,
   }
 
   // Check if type is a C++ class with non-trivial destructor.
-  const RecordType* RT = QT.getTypePtr()->getAs<RecordType>();
-  if (!RT || cast<CXXRecordDecl>(RT->getDecl())->hasTrivialDestructor())
-    return Scope;
+  if (const RecordType* RT = QT.getTypePtr()->getAs<RecordType>())
+    if (const CXXRecordDecl* CD = dyn_cast<CXXRecordDecl>(RT->getDecl()))
+      if (CD->hasTrivialDestructor())
+        return Scope;
 
   // Add the variable to scope
   Scope = createOrReuseLocalScope(Scope);