summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2015-05-28 00:14:02 +0000
committerRichard Trieu <rtrieu@google.com>2015-05-28 00:14:02 +0000
commit95a192a3abdd9ab817b5241c7a9c9fec304784d5 (patch)
tree8e3de3c6e7d9096bf8c5d8b6ebc1ede8f88af0a0 /clang/lib/Analysis
parentcaf09fe0225ef50019df6f495aaf17b40346c4f7 (diff)
downloadbcm5719-llvm-95a192a3abdd9ab817b5241c7a9c9fec304784d5.tar.gz
bcm5719-llvm-95a192a3abdd9ab817b5241c7a9c9fec304784d5.zip
Update -Winvalid-noreturn to handle destructors better.
When checking if a function is noreturn, consider a codepath to be noreturn if the path destroys a class and the class destructor, base class destructors, or member field destructors are marked noreturn. Differential Revision: http://reviews.llvm.org/D9454 llvm-svn: 238382
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r--clang/lib/Analysis/CFG.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp
index 2744c5fbe72..6f624ee4060 100644
--- a/clang/lib/Analysis/CFG.cpp
+++ b/clang/lib/Analysis/CFG.cpp
@@ -1179,8 +1179,7 @@ void CFGBuilder::addAutomaticObjDtors(LocalScope::const_iterator B,
}
Ty = Context->getBaseElementType(Ty);
- const CXXDestructorDecl *Dtor = Ty->getAsCXXRecordDecl()->getDestructor();
- if (Dtor->isNoReturn())
+ if (Ty->getAsCXXRecordDecl()->isAnyDestructorNoReturn())
Block = createNoReturnBlock();
else
autoCreateBlock();
@@ -3682,7 +3681,7 @@ CFGBlock *CFGBuilder::VisitCXXBindTemporaryExprForTemporaryDtors(
const CXXDestructorDecl *Dtor = E->getTemporary()->getDestructor();
- if (Dtor->isNoReturn()) {
+ if (Dtor->getParent()->isAnyDestructorNoReturn()) {
// If the 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
OpenPOWER on IntegriCloud