diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-03-02 20:32:29 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-03-02 20:32:29 +0000 |
commit | e06a55c6b9a278705d723da399eb72eb6a23ddc2 (patch) | |
tree | 0ccdc1be6a0ca716bf7e046ebbbd527a5338f1f0 /clang/lib/Sema/AnalysisBasedWarnings.cpp | |
parent | bd6f7f9770728a425388c8d4d9b1aec4a5fac5e1 (diff) | |
download | bcm5719-llvm-e06a55c6b9a278705d723da399eb72eb6a23ddc2.tar.gz bcm5719-llvm-e06a55c6b9a278705d723da399eb72eb6a23ddc2.zip |
Introduce CFGImplicitDtor::isNoReturn() to query whether a destructor actually returns. Use this for -Wreturn-type to prune false positives reported in PR 6884.
llvm-svn: 126875
Diffstat (limited to 'clang/lib/Sema/AnalysisBasedWarnings.cpp')
-rw-r--r-- | clang/lib/Sema/AnalysisBasedWarnings.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp index 6a422242a9d..84efbd50d1a 100644 --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -129,12 +129,27 @@ static ControlFlowKind CheckFallThrough(AnalysisContext &AC) { // normal. We need to look pass the destructors for the return // statement (if it exists). CFGBlock::const_reverse_iterator ri = B.rbegin(), re = B.rend(); + bool hasNoReturnDtor = false; + for ( ; ri != re ; ++ri) { CFGElement CE = *ri; + + // FIXME: The right solution is to just sever the edges in the + // CFG itself. + if (const CFGImplicitDtor *iDtor = ri->getAs<CFGImplicitDtor>()) + if (iDtor->isNoReturn()) { + hasNoReturnDtor = true; + HasFakeEdge = true; + break; + } + if (isa<CFGStmt>(CE)) break; } + if (hasNoReturnDtor) + continue; + // No more CFGElements in the block? if (ri == re) { if (B.getTerminator() && isa<CXXTryStmt>(B.getTerminator())) { |