diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-07-18 04:57:57 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-07-18 04:57:57 +0000 |
commit | 88237bf587581026dcfc8386abf055cb201aa487 (patch) | |
tree | 3b287e353c369399f7f167add4fae413a3633af3 /lib/Analysis | |
parent | 517bb844016064f303416f09f1aeb123e32c0f66 (diff) |
Teach CFG construction about destructors resulting from references to array types. Fixes crash in <rdar://problem/11671507>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160424 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/CFG.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index e3cd74b1e4..e141ed9a44 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -776,13 +776,12 @@ void CFGBuilder::addAutomaticObjDtors(LocalScope::const_iterator B, // If this destructor is marked as a no-return destructor, we need to // create a new block for the destructor which does not have as a successor // anything built thus far: control won't flow out of this block. - QualType Ty; - if ((*I)->getType()->isReferenceType()) { + QualType Ty = (*I)->getType(); + if (Ty->isReferenceType()) { Ty = getReferenceInitTemporaryType(*Context, (*I)->getInit()); - } else { - Ty = Context->getBaseElementType((*I)->getType()); } - + Ty = Context->getBaseElementType(Ty); + const CXXDestructorDecl *Dtor = Ty->getAsCXXRecordDecl()->getDestructor(); if (cast<FunctionType>(Dtor->getType())->getNoReturnAttr()) Block = createNoReturnBlock(); |