Use "getRanges" in default implementation of "getEndPath" to determine

the ranges of highlighted elements in the source code.

llvm-svn: 49181
This commit is contained in:
Ted Kremenek 2008-04-03 18:00:37 +00:00
parent cb2dc8eca5
commit 89575b7bcb
1 changed files with 12 additions and 2 deletions

View 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;
}