aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/BugReporter.cpp
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
commit2f0e89ea96292d2974eb1a7dddc0e9870aa86bb7 (patch)
tree5629147b4f1d47ceebcfce04368e3a2628dbab1a /lib/Analysis/BugReporter.cpp
parent59b6d5ae1c42515340a48040f6ff576a6f48a9c3 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BugReporter.cpp')
-rw-r--r--lib/Analysis/BugReporter.cpp42
1 files changed, 25 insertions, 17 deletions
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp
index b736282aea..6b68d7f70e 100644
--- a/lib/Analysis/BugReporter.cpp
+++ b/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);
+ }
}