diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-03-03 01:01:03 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-03-03 01:01:03 +0000 |
commit | 697d42db6cba7a5994d955ce31be2c097902cf0c (patch) | |
tree | 804ed6b8ee72a5343831508d748e8296e9fb5c3b | |
parent | 2ae00543d6e1bd7dba0ce2dacec740bb6049a2dd (diff) |
Teach CFGImplicitDtor::getDestructorDecl() about reference types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126909 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Analysis/CFG.cpp | 5 | ||||
-rw-r--r-- | test/SemaCXX/return-noreturn.cpp | 12 |
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index c433639ec1..fc50071a32 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -2782,9 +2782,10 @@ const CXXDestructorDecl *CFGImplicitDtor::getDestructorDecl() const { 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 @@ const CXXDestructorDecl *CFGImplicitDtor::getDestructorDecl() const { // Not yet supported. return 0; } - assert(0 && "getKind() returned bogus value"); + llvm_unreachable("getKind() returned bogus value"); return 0; } diff --git a/test/SemaCXX/return-noreturn.cpp b/test/SemaCXX/return-noreturn.cpp index 890fb9017c..4fb3732201 100644 --- a/test/SemaCXX/return-noreturn.cpp +++ b/test/SemaCXX/return-noreturn.cpp @@ -27,3 +27,15 @@ int pr6884_h(int x) { } } } + +// 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); +} + |