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
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp
index d27ead4..6872ab6 100644
--- a/lib/Analysis/BugReporter.cpp
+++ b/lib/Analysis/BugReporter.cpp
@@ -788,7 +788,11 @@
   
   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 @@
     // 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) {