From de7161fa687201393edf0b92a0bc9c6d4023cc84 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 3 Apr 2008 18:00:37 +0000 Subject: [PATCH] Use "getRanges" in default implementation of "getEndPath" to determine 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 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp index 9954298165..8eb200017f 100644 --- a/lib/Analysis/BugReporter.cpp +++ b/lib/Analysis/BugReporter.cpp @@ -53,8 +53,18 @@ BugDescription::getEndPath(ASTContext& Ctx, ExplodedNode *N) const { FullSourceLoc L(S->getLocStart(), Ctx.getSourceManager()); PathDiagnosticPiece* P = new PathDiagnosticPiece(L, getDescription()); - if (Expr* E = dyn_cast(S)) - P->addRange(E->getSourceRange()); + const SourceRange *Beg, *End; + getRanges(Beg, End); + + if (Beg == End) { + if (Expr* E = dyn_cast(S)) + P->addRange(E->getSourceRange()); + } + else { + assert (Beg < End); + for (; Beg != End; ++Beg) + P->addRange(*Beg); + } return P; } -- 2.40.0