When not emitting path diagnostics in BugReporter::EmitWarning(), use the
BugReport-specific SourceRanges (when available).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49486 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp
index c851696..0f7b235 100644
--- a/lib/Analysis/BugReporter.cpp
+++ b/lib/Analysis/BugReporter.cpp
@@ -358,8 +358,18 @@
if (!S)
return;
- SourceRange Range = S->getSourceRange();
+ const SourceRange *Beg, *End;
+ R.getRanges(Beg, End);
- Diag.Report(FullSourceLoc(S->getLocStart(), Ctx.getSourceManager()),
- ErrorDiag, NULL, 0, &Range, 1);
+ if (Beg == End) {
+ SourceRange Range = S->getSourceRange();
+
+ Diag.Report(FullSourceLoc(S->getLocStart(), Ctx.getSourceManager()),
+ ErrorDiag, NULL, 0, &Range, 1);
+
+ }
+ else
+ Diag.Report(FullSourceLoc(S->getLocStart(), Ctx.getSourceManager()),
+ ErrorDiag, NULL, 0, Beg, End - Beg);
+
}