aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/BugReporter.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-04-22 20:36:26 +0000
committerTed Kremenek <kremenek@apple.com>2009-04-22 20:36:26 +0000
commit5c7168cbe8a0eabd05e0e12e469090d2cabd27c0 (patch)
treeadfa91cf9a1ad427a07f7797095a9962d1a345d9 /lib/Analysis/BugReporter.cpp
parent1725f683432715e5afe34d476024bd6f16eac3fc (diff)
BugReporter (extensive diagnostics): always add an edge if there is no location
context. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69823 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BugReporter.cpp')
-rw-r--r--lib/Analysis/BugReporter.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp
index d27ead442e..6872ab622e 100644
--- a/lib/Analysis/BugReporter.cpp
+++ b/lib/Analysis/BugReporter.cpp
@@ -788,7 +788,11 @@ class VISIBILITY_HIDDEN EdgeBuilder {
void popLocation() {
PathDiagnosticLocation L = CLocs.back();
- if (L.asLocation().isFileID()) rawAddEdge(CLocs.back());
+ if (L.asLocation().isFileID()) {
+ // For contexts, we only one the first character as the range.
+ L = PathDiagnosticLocation(L.asLocation(), L.getManager());
+ rawAddEdge(CLocs.back());
+ }
CLocs.pop_back();
}
@@ -946,6 +950,9 @@ void EdgeBuilder::addEdge(PathDiagnosticLocation NewLoc, bool alwaysAdd) {
// Context does not contain the location. Flush it.
popLocation();
}
+
+ // If we reach here, there is no enclosing context. Just add the edge.
+ rawAddEdge(NewLoc);
}
void EdgeBuilder::addContext(const Stmt *S) {