[cfe-commits] r71516 - in /cfe/trunk: include/clang/Analysis/PathDiagnostic.h lib/Analysis/BugReporter.cpp

Ted Kremenek kremenek at apple.com
Mon May 11 16:50:59 PDT 2009


Author: kremenek
Date: Mon May 11 18:50:59 2009
New Revision: 71516

URL: http://llvm.org/viewvc/llvm-project?rev=71516&view=rev
Log:
BugReport::getEndPath() - Only add a Stmt's range to the constructed PathDiagnosticEventPiece if the BugReport contained no explicit ranges.

Modified:
    cfe/trunk/include/clang/Analysis/PathDiagnostic.h
    cfe/trunk/lib/Analysis/BugReporter.cpp

Modified: cfe/trunk/include/clang/Analysis/PathDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathDiagnostic.h?rev=71516&r1=71515&r2=71516&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathDiagnostic.h (original)
+++ cfe/trunk/include/clang/Analysis/PathDiagnostic.h Mon May 11 18:50:59 2009
@@ -244,11 +244,12 @@
 
 public:
   PathDiagnosticEventPiece(const PathDiagnosticLocation &pos,
-                           const std::string& s)
-    : PathDiagnosticSpotPiece(pos, s, Event) {}
+                           const std::string& s, bool addPosRange = true)
+    : PathDiagnosticSpotPiece(pos, s, Event, addPosRange) {}
   
-  PathDiagnosticEventPiece(const PathDiagnosticLocation &pos, const char* s)
-    : PathDiagnosticSpotPiece(pos, s, Event) {}
+  PathDiagnosticEventPiece(const PathDiagnosticLocation &pos, const char* s,
+                           bool addPosRange = true)
+    : PathDiagnosticSpotPiece(pos, s, Event, addPosRange) {}
   
   ~PathDiagnosticEventPiece();
 

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

==============================================================================
--- cfe/trunk/lib/Analysis/BugReporter.cpp (original)
+++ cfe/trunk/lib/Analysis/BugReporter.cpp Mon May 11 18:50:59 2009
@@ -1198,13 +1198,16 @@
   
   if (!S)
     return NULL;
-  
-  FullSourceLoc L(S->getLocStart(), BRC.getSourceManager());
-  PathDiagnosticPiece* P = new PathDiagnosticEventPiece(L, getDescription());
-  
+
   const SourceRange *Beg, *End;
-  getRanges(BRC.getBugReporter(), Beg, End);
+  getRanges(BRC.getBugReporter(), Beg, End);  
+  PathDiagnosticLocation L(S, BRC.getSourceManager());
   
+  // Only add the statement itself as a range if we didn't specify any
+  // special ranges for this report.
+  PathDiagnosticPiece* P = new PathDiagnosticEventPiece(L, getDescription(),
+                                                        Beg == End);
+    
   for (; Beg != End; ++Beg)
     P->addRange(*Beg);
   





More information about the cfe-commits mailing list