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