summaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/BugReporter.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2013-06-06 00:12:37 +0000
committerJordan Rose <jordan_rose@apple.com>2013-06-06 00:12:37 +0000
commit574c7cf6d0c8e8f8ecda360ae271d5391c404534 (patch)
treec1f894655d4aad66695652969f93e7da72a803c3 /lib/StaticAnalyzer/Core/BugReporter.cpp
parentc47b6f3c9efcd6b3039856a39665a3aef1ed334e (diff)
downloadclang-574c7cf6d0c8e8f8ecda360ae271d5391c404534.tar.gz
clang-574c7cf6d0c8e8f8ecda360ae271d5391c404534.tar.bz2
clang-574c7cf6d0c8e8f8ecda360ae271d5391c404534.tar.xz
[analyzer; new edges] Ignore self-edges, not all edges with the same location.
The edge optimizer needs to see edges for, say, implicit casts (which have the same source location as their operand) to uniformly simplify the entire path. However, we still don't want to produce edges from a statement to /itself/, which could occur when two nodes in a row have the same statement location. This necessitated moving the check for redundant notes to after edge optimization, since the check relies on notes being adjacent in the path. <rdar://problem/14061675> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183357 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/BugReporter.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/BugReporter.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp
index 853582a1ff..5e41e267bf 100644
--- a/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -1543,9 +1543,9 @@ static void addEdgeToPath(PathPieces &path,
return;
}
- // FIXME: ignore intra-macro edges for now.
- if (NewLoc.asLocation().getExpansionLoc() ==
- PrevLoc.asLocation().getExpansionLoc())
+ // Ignore self-edges, which occur when there are multiple nodes at the same
+ // statement.
+ if (NewLoc.asStmt() && NewLoc.asStmt() == PrevLoc.asStmt())
return;
path.push_front(new PathDiagnosticControlFlowPiece(NewLoc,
@@ -3168,9 +3168,6 @@ bool GRBugReporter::generatePathDiagnostic(PathDiagnostic& PD,
// Finally, prune the diagnostic path of uninteresting stuff.
if (!PD.path.empty()) {
- // Remove messages that are basically the same.
- removeRedundantMsgs(PD.getMutablePieces());
-
if (R->shouldPrunePath() && getAnalyzerOptions().shouldPrunePaths()) {
bool stillHasNotes = removeUnneededCalls(PD.getMutablePieces(), R, LCM);
assert(stillHasNotes);
@@ -3192,6 +3189,10 @@ bool GRBugReporter::generatePathDiagnostic(PathDiagnostic& PD,
// for top-level functions.
dropFunctionEntryEdge(PD.getMutablePieces(), LCM, SM);
}
+
+ // Remove messages that are basically the same.
+ // We have to do this after edge optimization in the Extensive mode.
+ removeRedundantMsgs(PD.getMutablePieces());
}
// We found a report and didn't suppress it.