diff options
Diffstat (limited to 'lib/Analysis/BugReporter.cpp')
-rw-r--r-- | lib/Analysis/BugReporter.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp index c851696a30..0f7b235944 100644 --- a/lib/Analysis/BugReporter.cpp +++ b/lib/Analysis/BugReporter.cpp @@ -358,8 +358,18 @@ void BugReporter::EmitWarning(BugReport& R, ExplodedNode<ValueState>* N) { if (!S) return; - SourceRange Range = S->getSourceRange(); + const SourceRange *Beg, *End; + R.getRanges(Beg, End); + + 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); - Diag.Report(FullSourceLoc(S->getLocStart(), Ctx.getSourceManager()), - ErrorDiag, NULL, 0, &Range, 1); } |