[cfe-commits] r148777 - in /cfe/trunk: lib/Analysis/CFG.cpp test/SemaCXX/warn-unreachable.cpp

David Blaikie dblaikie at gmail.com
Mon Jan 23 20:29:32 PST 2012


Author: dblaikie
Date: Mon Jan 23 22:29:31 2012
New Revision: 148777

URL: http://llvm.org/viewvc/llvm-project?rev=148777&view=rev
Log:
More fixes/tests.

Modified:
    cfe/trunk/lib/Analysis/CFG.cpp
    cfe/trunk/test/SemaCXX/warn-unreachable.cpp

Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=148777&r1=148776&r2=148777&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Mon Jan 23 22:29:31 2012
@@ -721,7 +721,7 @@
     }
     
     const CXXDestructorDecl *Dtor = Ty->getAsCXXRecordDecl()->getDestructor();
-    if (cast<FunctionType>(Dtor->getType())->getNoReturnAttr())
+    if (Dtor && cast<FunctionType>(Dtor->getType())->getNoReturnAttr())
       Block = createNoReturnBlock();
     else
       autoCreateBlock();
@@ -864,7 +864,7 @@
 
   // Check if type is a C++ class with non-trivial destructor.
   if (const CXXRecordDecl *CD = QT->getAsCXXRecordDecl())
-    if (!CD->hasTrivialDestructor()) {
+    if (CD->hasDefinition() && !CD->hasTrivialDestructor()) {
       // Add the variable to scope
       Scope = createOrReuseLocalScope(Scope);
       Scope->addVar(VD);

Modified: cfe/trunk/test/SemaCXX/warn-unreachable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-unreachable.cpp?rev=148777&r1=148776&r2=148777&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-unreachable.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-unreachable.cpp Mon Jan 23 22:29:31 2012
@@ -132,3 +132,12 @@
 struct aligned_storage : imp<a> {
  ~aligned_storage() { }
 };
+
+// is this valid?
+template<typename T>
+class outer {
+  class inner;
+  void func() {
+    inner t;
+  }
+};





More information about the cfe-commits mailing list