[cfe-commits] r126909 - in /cfe/trunk: lib/Analysis/CFG.cpp test/SemaCXX/return-noreturn.cpp

Ted Kremenek kremenek at apple.com
Wed Mar 2 17:01:03 PST 2011


Author: kremenek
Date: Wed Mar  2 19:01:03 2011
New Revision: 126909

URL: http://llvm.org/viewvc/llvm-project?rev=126909&view=rev
Log:
Teach CFGImplicitDtor::getDestructorDecl() about reference types.

Modified:
    cfe/trunk/lib/Analysis/CFG.cpp
    cfe/trunk/test/SemaCXX/return-noreturn.cpp

Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=126909&r1=126908&r2=126909&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Wed Mar  2 19:01:03 2011
@@ -2782,9 +2782,10 @@
     case CFGElement::AutomaticObjectDtor: {
       const VarDecl *var = cast<CFGAutomaticObjDtor>(this)->getVarDecl();
       QualType ty = var->getType();
+      ty = ty.getNonReferenceType();
       const RecordType *recordType = ty->getAs<RecordType>();
       const CXXRecordDecl *classDecl =
-        cast<CXXRecordDecl>(recordType->getDecl());
+      cast<CXXRecordDecl>(recordType->getDecl());
       return classDecl->getDestructor();      
     }
     case CFGElement::TemporaryDtor: {
@@ -2799,7 +2800,7 @@
       // Not yet supported.
       return 0;
   }
-  assert(0 && "getKind() returned bogus value");
+  llvm_unreachable("getKind() returned bogus value");
   return 0;
 }
 

Modified: cfe/trunk/test/SemaCXX/return-noreturn.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/return-noreturn.cpp?rev=126909&r1=126908&r2=126909&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/return-noreturn.cpp (original)
+++ cfe/trunk/test/SemaCXX/return-noreturn.cpp Wed Mar  2 19:01:03 2011
@@ -27,3 +27,15 @@
     }
   }
 }
+
+// PR9380
+struct PR9380 {
+  ~PR9380();
+};
+struct PR9380_B : public PR9380 {
+  PR9380_B( const PR9380& str );
+};
+void test_PR9380(const PR9380& aKey) {
+  const PR9380& flatKey = PR9380_B(aKey);
+}
+





More information about the cfe-commits mailing list