summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/AnalysisBasedWarnings.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-04-30 07:10:06 +0000
committerJohn McCall <rjmccall@apple.com>2010-04-30 07:10:06 +0000
commit5af1aa63935dc9da2236d3aad7dad1edccd0af8b (patch)
tree22f018e12088dd24c06c7b58d1c94c41efb0576e /clang/lib/Sema/AnalysisBasedWarnings.cpp
parent8b895228d91c0e0d0ab541dc8d7ce8ac8f9b3c15 (diff)
downloadbcm5719-llvm-5af1aa63935dc9da2236d3aad7dad1edccd0af8b.tar.gz
bcm5719-llvm-5af1aa63935dc9da2236d3aad7dad1edccd0af8b.zip
An edge from a call expression to the exit block is only an abnormal edge
if *none* of the successors of the call expression is the exit block. This matters when a call of bool type is the condition of (say) a while loop in a function with no statements after the loop. This *can* happen in C, but it's much more common in C++ because of overloaded operators. Suppresses some substantial number of spurious -Wmissing-noreturn warnings. llvm-svn: 102696
Diffstat (limited to 'clang/lib/Sema/AnalysisBasedWarnings.cpp')
-rw-r--r--clang/lib/Sema/AnalysisBasedWarnings.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp
index 7c1d8cbae9e..dffdf6b4455 100644
--- a/clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -147,7 +147,8 @@ static ControlFlowKind CheckFallThrough(AnalysisContext &AC) {
bool NoReturnEdge = false;
if (CallExpr *C = dyn_cast<CallExpr>(S)) {
- if (B.succ_begin()[0] != &cfg->getExit()) {
+ if (std::find(B.succ_begin(), B.succ_end(), &cfg->getExit())
+ == B.succ_end()) {
HasAbnormalEdge = true;
continue;
}
OpenPOWER on IntegriCloud