diff options
-rw-r--r-- | lib/Analysis/ReachableCode.cpp | 5 | ||||
-rw-r--r-- | lib/Sema/AnalysisBasedWarnings.cpp | 16 | ||||
-rw-r--r-- | test/SemaCXX/return-noreturn.cpp | 7 |
3 files changed, 6 insertions, 22 deletions
diff --git a/lib/Analysis/ReachableCode.cpp b/lib/Analysis/ReachableCode.cpp index b9585800c9..802b990143 100644 --- a/lib/Analysis/ReachableCode.cpp +++ b/lib/Analysis/ReachableCode.cpp @@ -30,12 +30,11 @@ static SourceLocation GetUnreachableLoc(const CFGBlock &b, SourceRange &R1, unsigned sn = 0; R1 = R2 = SourceRange(); -top: if (sn < b.size()) { CFGStmt CS = b[sn].getAs<CFGStmt>(); if (!CS) - goto top; - + return SourceLocation(); + S = CS.getStmt(); } else if (b.getTerminator()) S = b.getTerminator(); diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp index f4fde40bfb..20a503d6a5 100644 --- a/lib/Sema/AnalysisBasedWarnings.cpp +++ b/lib/Sema/AnalysisBasedWarnings.cpp @@ -177,19 +177,6 @@ static ControlFlowKind CheckFallThrough(AnalysisContext &AC) { } } } - // FIXME: Remove this hack once temporaries and their destructors are - // modeled correctly by the CFG. - if (ExprWithCleanups *E = dyn_cast<ExprWithCleanups>(S)) { - for (unsigned I = 0, N = E->getNumTemporaries(); I != N; ++I) { - const FunctionDecl *FD = E->getTemporary(I)->getDestructor(); - if (FD->hasAttr<NoReturnAttr>() || - FD->getType()->getAs<FunctionType>()->getNoReturnAttr()) { - NoReturnEdge = true; - HasFakeEdge = true; - break; - } - } - } // FIXME: Add noreturn message sends. if (NoReturnEdge == false) HasPlainEdge = true; @@ -405,7 +392,8 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P, // Don't generate EH edges for CallExprs as we'd like to avoid the n^2 // explosion for destrutors that can result and the compile time hit. - AnalysisContext AC(D, 0, false); + AnalysisContext AC(D, 0, /*useUnoptimizedCFG=*/false, /*addehedges=*/false, + /*addImplicitDtors=*/true, /*addInitializers=*/true); // Warning: check missing 'return' if (P.enableCheckFallThrough) { diff --git a/test/SemaCXX/return-noreturn.cpp b/test/SemaCXX/return-noreturn.cpp index dfd5487321..f7072b2177 100644 --- a/test/SemaCXX/return-noreturn.cpp +++ b/test/SemaCXX/return-noreturn.cpp @@ -7,14 +7,11 @@ namespace PR6884 { ~abort_struct() __attribute__((noreturn)); }; - // FIXME: Should either of these actually warn, since the destructor is - // marked noreturn? - int f() { abort_struct(); - } // expected-warning{{control reaches end of non-void function}} + } int f2() { abort_struct s; - } // expected-warning{{control reaches end of non-void function}} + } } |