forked from OSchip/llvm-project
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
This commit is contained in:
parent
42dd577238
commit
423edc2384
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue