]> granicus.if.org Git - clang/commitdiff
Use "getRanges" in default implementation of "getEndPath" to determine
authorTed Kremenek <kremenek@apple.com>
Thu, 3 Apr 2008 18:00:37 +0000 (18:00 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 3 Apr 2008 18:00:37 +0000 (18:00 +0000)
the ranges of highlighted elements in the source code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49181 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/BugReporter.cpp

index 9954298165a6b7df4e7692cebb2637388c6f8b37..8eb200017f2b25cec03379caffd6ccfe0003d99d 100644 (file)
@@ -53,8 +53,18 @@ BugDescription::getEndPath(ASTContext& Ctx, ExplodedNode<ValueState> *N) const {
   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;
 }