summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/BugReporter.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-03 18:00:37 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-03 18:00:37 +0000
commit89575b7bcb74df8c46c56c4f0e58c121a2bd980b (patch)
treef9266042dfca17fdfd45e2ba43749e5f16aa77af /clang/lib/Analysis/BugReporter.cpp
parentcb2dc8eca519a09c4c1fbbf852affacfda53a63b (diff)
downloadbcm5719-llvm-89575b7bcb74df8c46c56c4f0e58c121a2bd980b.tar.gz
bcm5719-llvm-89575b7bcb74df8c46c56c4f0e58c121a2bd980b.zip
Use "getRanges" in default implementation of "getEndPath" to determine
the ranges of highlighted elements in the source code. llvm-svn: 49181
Diffstat (limited to 'clang/lib/Analysis/BugReporter.cpp')
-rw-r--r--clang/lib/Analysis/BugReporter.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/Analysis/BugReporter.cpp b/clang/lib/Analysis/BugReporter.cpp
index 9954298165a..8eb200017f2 100644
--- a/clang/lib/Analysis/BugReporter.cpp
+++ b/clang/lib/Analysis/BugReporter.cpp
@@ -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;
}
OpenPOWER on IntegriCloud