summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-14 18:06:42 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-14 18:06:42 +0000
commitbae225d57a27427f78911a2ad25080b3af3a38aa (patch)
tree34f486f930bd05ed6d3f8d4e0f7db8194f1c6982
parentea3aa5bf11eacebc6fe65e7f4fc4f9ddac863f29 (diff)
downloadbcm5719-llvm-bae225d57a27427f78911a2ad25080b3af3a38aa.tar.gz
bcm5719-llvm-bae225d57a27427f78911a2ad25080b3af3a38aa.zip
Have BugReporter::EmitWarning use the PathDiagnosticClient if it is available.
llvm-svn: 49668
-rw-r--r--clang/lib/Analysis/BugReporter.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/clang/lib/Analysis/BugReporter.cpp b/clang/lib/Analysis/BugReporter.cpp
index 310fdc9accb..7572a556799 100644
--- a/clang/lib/Analysis/BugReporter.cpp
+++ b/clang/lib/Analysis/BugReporter.cpp
@@ -369,17 +369,29 @@ void BugReporter::EmitWarning(BugReport& R) {
if (N && IsCached(N))
return;
- std::ostringstream os;
- os << "[CHECKER] " << R.getDescription();
-
- unsigned ErrorDiag = Diag.getCustomDiagID(Diagnostic::Warning,
- os.str().c_str());
-
- // FIXME: Add support for multiple ranges.
-
FullSourceLoc L = R.getLocation(Ctx.getSourceManager());
-
+
const SourceRange *Beg, *End;
R.getRanges(Beg, End);
- Diag.Report(L, ErrorDiag, NULL, 0, Beg, End - Beg);
+
+ if (!PD) {
+
+ std::ostringstream os;
+ os << "[CHECKER] " << R.getDescription();
+
+ unsigned ErrorDiag = Diag.getCustomDiagID(Diagnostic::Warning,
+ os.str().c_str());
+
+ Diag.Report(L, ErrorDiag, NULL, 0, Beg, End - Beg);
+ }
+ else {
+ PathDiagnostic D(R.getName());
+ PathDiagnosticPiece* piece = new PathDiagnosticPiece(L, R.getDescription());
+
+ for ( ; Beg != End; ++Beg)
+ piece->addRange(*Beg);
+
+ D.push_back(piece);
+ PD->HandlePathDiagnostic(D);
+ }
}
OpenPOWER on IntegriCloud