[llvm-branch-commits] [cfe-branch] r71522 - in /cfe/branches/Apple/Dib: include/clang/Analysis/PathDiagnostic.h lib/Analysis/BugReporter.cpp

Mike Stump mrs at apple.com
Mon May 11 17:19:25 PDT 2009


Author: mrs
Date: Mon May 11 19:19:23 2009
New Revision: 71522

URL: http://llvm.org/viewvc/llvm-project?rev=71522&view=rev
Log:
Merge in 71516:

BugReport::getEndPath() - Only add a Stmt's range to the constructed PathDiagnosticEventPiece if the BugReport contained no explicit ranges.

Modified:
    cfe/branches/Apple/Dib/include/clang/Analysis/PathDiagnostic.h
    cfe/branches/Apple/Dib/lib/Analysis/BugReporter.cpp

Modified: cfe/branches/Apple/Dib/include/clang/Analysis/PathDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/include/clang/Analysis/PathDiagnostic.h?rev=71522&r1=71521&r2=71522&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/include/clang/Analysis/PathDiagnostic.h (original)
+++ cfe/branches/Apple/Dib/include/clang/Analysis/PathDiagnostic.h Mon May 11 19:19:23 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/branches/Apple/Dib/lib/Analysis/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/BugReporter.cpp?rev=71522&r1=71521&r2=71522&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/BugReporter.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/BugReporter.cpp Mon May 11 19:19:23 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 llvm-branch-commits mailing list