diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-04-10 16:12:38 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-04-10 16:12:38 +0000 |
commit | 42d9db75f077d05362a611c7ea05a65d1d6d6f5a (patch) | |
tree | d266dfd895b021bfa600e9b3fbf98c3e54db2d2a /clang/lib/Analysis/BugReporter.cpp | |
parent | 83744ddbd9a3dbd4931c2a19f1ff201d4f665e79 (diff) | |
download | bcm5719-llvm-42d9db75f077d05362a611c7ea05a65d1d6d6f5a.tar.gz bcm5719-llvm-42d9db75f077d05362a611c7ea05a65d1d6d6f5a.zip |
When not emitting path diagnostics in BugReporter::EmitWarning(), use the
BugReport-specific SourceRanges (when available).
llvm-svn: 49486
Diffstat (limited to 'clang/lib/Analysis/BugReporter.cpp')
-rw-r--r-- | clang/lib/Analysis/BugReporter.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/clang/lib/Analysis/BugReporter.cpp b/clang/lib/Analysis/BugReporter.cpp index c851696a301..0f7b2359444 100644 --- a/clang/lib/Analysis/BugReporter.cpp +++ b/clang/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); } |