Have BugReporter::EmitWarning use the PathDiagnosticClient if it is available.
llvm-svn: 49668
This commit is contained in:
parent
ea3aa5bf11
commit
bae225d57a
|
|
@ -369,17 +369,29 @@ void BugReporter::EmitWarning(BugReport& R) {
|
||||||
if (N && IsCached(N))
|
if (N && IsCached(N))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
FullSourceLoc L = R.getLocation(Ctx.getSourceManager());
|
||||||
|
|
||||||
|
const SourceRange *Beg, *End;
|
||||||
|
R.getRanges(Beg, End);
|
||||||
|
|
||||||
|
if (!PD) {
|
||||||
|
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "[CHECKER] " << R.getDescription();
|
os << "[CHECKER] " << R.getDescription();
|
||||||
|
|
||||||
unsigned ErrorDiag = Diag.getCustomDiagID(Diagnostic::Warning,
|
unsigned ErrorDiag = Diag.getCustomDiagID(Diagnostic::Warning,
|
||||||
os.str().c_str());
|
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);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue