diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-03-03 01:21:32 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-03-03 01:21:32 +0000 |
commit | c5aff4497e5bfd7523e00b87560c1a5aa65136cc (patch) | |
tree | ffbde3af062dbdb627a5cf1f964a306172eec721 /lib/Analysis | |
parent | 697d42db6cba7a5994d955ce31be2c097902cf0c (diff) |
Teach CFGImplicitDtor::getDestructorDecl() about arrays of objects with destructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126910 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/CFG.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index fc50071a32..6d8d5c53f6 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -2772,7 +2772,8 @@ CFG* CFG::buildCFG(const Decl *D, Stmt* Statement, ASTContext *C, return Builder.buildCFG(D, Statement, C, BO); } -const CXXDestructorDecl *CFGImplicitDtor::getDestructorDecl() const { +const CXXDestructorDecl * +CFGImplicitDtor::getDestructorDecl(ASTContext &astContext) const { switch (getKind()) { case CFGElement::Invalid: case CFGElement::Statement: @@ -2783,6 +2784,9 @@ const CXXDestructorDecl *CFGImplicitDtor::getDestructorDecl() const { const VarDecl *var = cast<CFGAutomaticObjDtor>(this)->getVarDecl(); QualType ty = var->getType(); ty = ty.getNonReferenceType(); + if (const ArrayType *arrayType = astContext.getAsArrayType(ty)) { + ty = arrayType->getElementType(); + } const RecordType *recordType = ty->getAs<RecordType>(); const CXXRecordDecl *classDecl = cast<CXXRecordDecl>(recordType->getDecl()); @@ -2804,8 +2808,8 @@ const CXXDestructorDecl *CFGImplicitDtor::getDestructorDecl() const { return 0; } -bool CFGImplicitDtor::isNoReturn() const { - if (const CXXDestructorDecl *cdecl = getDestructorDecl()) { +bool CFGImplicitDtor::isNoReturn(ASTContext &astContext) const { + if (const CXXDestructorDecl *cdecl = getDestructorDecl(astContext)) { QualType ty = cdecl->getType(); return cast<FunctionType>(ty)->getNoReturnAttr(); } |