diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-04-03 18:00:37 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-04-03 18:00:37 +0000 |
commit | 89575b7bcb74df8c46c56c4f0e58c121a2bd980b (patch) | |
tree | f9266042dfca17fdfd45e2ba43749e5f16aa77af /clang/lib/Analysis/BugReporter.cpp | |
parent | cb2dc8eca519a09c4c1fbbf852affacfda53a63b (diff) | |
download | bcm5719-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.cpp | 14 |
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; } |