]> granicus.if.org Git - clang/commitdiff
BugReporter (extensive diagnostics): don't mark location contexts that are
authorTed Kremenek <kremenek@apple.com>
Mon, 4 May 2009 18:15:17 +0000 (18:15 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 4 May 2009 18:15:17 +0000 (18:15 +0000)
control-flow expressions as dead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70887 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/BugReporter.cpp

index dcc88febec9f6a4407c93b1238b44f541d7b2bb4..a9d67713098fdf0946bd698f3a19861bb4157967 100644 (file)
@@ -955,7 +955,8 @@ void EdgeBuilder::addEdge(PathDiagnosticLocation NewLoc, bool alwaysAdd) {
     // Is the top location context the same as the one for the new location?
     if (TopContextLoc == CLoc) {
       if (alwaysAdd) {
-        if (IsConsumedExpr(TopContextLoc))
+        if (IsConsumedExpr(TopContextLoc) &&
+            !IsControlFlowExpr(TopContextLoc.asStmt()))
             TopContextLoc.markDead();
 
         rawAddEdge(NewLoc);
@@ -968,7 +969,7 @@ void EdgeBuilder::addEdge(PathDiagnosticLocation NewLoc, bool alwaysAdd) {
       if (alwaysAdd) {
         rawAddEdge(NewLoc);
         
-        if (IsConsumedExpr(CLoc)) {
+        if (IsConsumedExpr(CLoc) && !IsControlFlowExpr(CLoc.asStmt())) {
           CLocs.push_back(ContextLocation(CLoc, true));
           return;
         }