[cfe-commits] r69823 - /cfe/trunk/lib/Analysis/BugReporter.cpp

Ted Kremenek kremenek at apple.com
Wed Apr 22 13:36:26 PDT 2009


Author: kremenek
Date: Wed Apr 22 15:36:26 2009
New Revision: 69823

URL: http://llvm.org/viewvc/llvm-project?rev=69823&view=rev
Log:
BugReporter (extensive diagnostics): always add an edge if there is no location
context.

Modified:
    cfe/trunk/lib/Analysis/BugReporter.cpp

Modified: cfe/trunk/lib/Analysis/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BugReporter.cpp?rev=69823&r1=69822&r2=69823&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/BugReporter.cpp (original)
+++ cfe/trunk/lib/Analysis/BugReporter.cpp Wed Apr 22 15:36:26 2009
@@ -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) {





More information about the cfe-commits mailing list