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

Ted Kremenek kremenek at apple.com
Thu Apr 3 11:00:37 PDT 2008


Author: kremenek
Date: Thu Apr  3 13:00:37 2008
New Revision: 49181

URL: http://llvm.org/viewvc/llvm-project?rev=49181&view=rev
Log:
Use "getRanges" in default implementation of "getEndPath" to determine
the ranges of highlighted elements in the source code.

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=49181&r1=49180&r2=49181&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/BugReporter.cpp (original)
+++ cfe/trunk/lib/Analysis/BugReporter.cpp Thu Apr  3 13:00:37 2008
@@ -53,8 +53,18 @@
   FullSourceLoc L(S->getLocStart(), Ctx.getSourceManager());  
   PathDiagnosticPiece* P = new PathDiagnosticPiece(L, getDescription());
   
-  if (Expr* E = dyn_cast<Expr>(S))
-    P->addRange(E->getSourceRange());
+  const SourceRange *Beg, *End;
+  getRanges(Beg, End);
+  
+  if (Beg == End) {
+    if (Expr* E = dyn_cast<Expr>(S))
+      P->addRange(E->getSourceRange());
+  }
+  else {
+    assert (Beg < End);
+    for (; Beg != End; ++Beg)
+      P->addRange(*Beg);
+  }
   
   return P;
 }





More information about the cfe-commits mailing list