diff options
author | Mike Stump <mrs@apple.com> | 2010-01-20 00:34:04 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2010-01-20 00:34:04 +0000 |
commit | e2ab979cf6b52efac3b6c5f121900ec57a34689c (patch) | |
tree | 2d004988b1f52c848eeb0b47539b8475f2a6b58a /lib/Sema/SemaDecl.cpp | |
parent | e0356b10832390d5f44b3dc7ad4e6e104ebad556 (diff) |
Improve CheckFallThrough analysis in the presense of the new C++ EH
support. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93956 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index d2ac483db5..1e46787d8f 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -1496,6 +1496,7 @@ Sema::ControlFlowKind Sema::CheckFallThrough(AnalysisContext &AC) { bool HasLiveReturn = false; bool HasFakeEdge = false; bool HasPlainEdge = false; + bool HasAbnormalEdge = false; for (CFGBlock::pred_iterator I=cfg->getExit().pred_begin(), E = cfg->getExit().pred_end(); I != E; @@ -1528,9 +1529,17 @@ Sema::ControlFlowKind Sema::CheckFallThrough(AnalysisContext &AC) { continue; } } + if (isa<CXXTryStmt>(S)) { + HasAbnormalEdge = true; + continue; + } bool NoReturnEdge = false; if (CallExpr *C = dyn_cast<CallExpr>(S)) { + if (B.succ_begin()[0] != &cfg->getExit()) { + HasAbnormalEdge = true; + continue; + } Expr *CEE = C->getCallee()->IgnoreParenCasts(); if (CEE->getType().getNoReturnAttr()) { NoReturnEdge = true; @@ -1552,7 +1561,7 @@ Sema::ControlFlowKind Sema::CheckFallThrough(AnalysisContext &AC) { return NeverFallThrough; return NeverFallThroughOrReturn; } - if (HasFakeEdge || HasLiveReturn) + if (HasAbnormalEdge || HasFakeEdge || HasLiveReturn) return MaybeFallThrough; // This says AlwaysFallThrough for calls to functions that are not marked // noreturn, that don't return. If people would like this warning to be more |