[cfe-commits] r115254 - /cfe/trunk/lib/Analysis/CFG.cpp

Marcin Swiderski marcin.sfider at gmail.com
Thu Sep 30 17:31:22 PDT 2010


Author: sfider
Date: Thu Sep 30 19:31:22 2010
New Revision: 115254

URL: http://llvm.org/viewvc/llvm-project?rev=115254&view=rev
Log:
Fixed checking for trivial destructor in CFGBuilder::addLocalScopeForVarDecl. Checked type does not have to represent C++ class.

Modified:
    cfe/trunk/lib/Analysis/CFG.cpp

Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=115254&r1=115253&r2=115254&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Thu Sep 30 19:31:22 2010
@@ -564,9 +564,10 @@
   }
 
   // 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);





More information about the cfe-commits mailing list