Teach CFGImplicitDtor::getDestructorDecl() about reference types.

llvm-svn: 126909
This commit is contained in:
Ted Kremenek 2011-03-03 01:01:03 +00:00
parent 86b900baca
commit 1676a042e3
2 changed files with 15 additions and 2 deletions

View File

@ -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;
}

View File

@ -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);
}