summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-18 22:56:53 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-18 22:56:53 +0000
commit423edc2384faf9baa617e02ce73e92cf29330408 (patch)
tree5e6209ccc26f2fa6c9708027b388a4b609525ab9 /clang/lib
parent42dd5772382a0d211f3351788c61b3219640ca7b (diff)
downloadbcm5719-llvm-423edc2384faf9baa617e02ce73e92cf29330408.tar.gz
bcm5719-llvm-423edc2384faf9baa617e02ce73e92cf29330408.zip
Another bug fix in emitting warnings without a path: construct a unit PathDiagnostic as we did
before. This allows the HTMLDiagnostic object to retrieve the bug type, bug description, etc. llvm-svn: 49939
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Analysis/BugReporter.cpp42
1 files changed, 25 insertions, 17 deletions
diff --git a/clang/lib/Analysis/BugReporter.cpp b/clang/lib/Analysis/BugReporter.cpp
index b736282aea5..6b68d7f70ec 100644
--- a/clang/lib/Analysis/BugReporter.cpp
+++ b/clang/lib/Analysis/BugReporter.cpp
@@ -410,21 +410,29 @@ void BugReporter::EmitWarning(BugReport& R) {
else
R.getRanges(Beg, End);
- // Compute the message.
-
- std::ostringstream os;
- os << "[CHECKER] ";
-
- if (D.empty())
- os << R.getDescription();
- else
- os << D.back()->getString();
-
- unsigned ErrorDiag = Diag.getCustomDiagID(Diagnostic::Warning,
- os.str().c_str());
-
- if (PD)
- Diag.Report(PD, L, ErrorDiag, NULL, 0, Beg, End - Beg);
- else
- Diag.Report(L, ErrorDiag, NULL, 0, Beg, End - Beg);
+ if (PD) {
+ 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);
+ }
+ else {
+ std::ostringstream os;
+ os << "[CHECKER] ";
+
+ if (D.empty())
+ os << R.getDescription();
+ else
+ os << D.back()->getString();
+
+
+ unsigned ErrorDiag = Diag.getCustomDiagID(Diagnostic::Warning,
+ os.str().c_str());
+
+ Diag.Report(L, ErrorDiag, NULL, 0, Beg, End - Beg);
+ }
}
OpenPOWER on IntegriCloud