Added variation of the "Report" method in the class Diagnostic that takes

an optional DiagnosticClient argument that differs from the client stored
internally in the Diagnostic object.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48986 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ted Kremenek 2008-03-31 18:23:15 +00:00
Родитель f186f303ee
Коммит 615f517709
2 изменённых файлов: 17 добавлений и 5 удалений

Просмотреть файл

@ -149,15 +149,23 @@ public:
/// diag::kind enum.
void Report(FullSourceLoc Pos, unsigned DiagID,
const std::string *Strs = 0, unsigned NumStrs = 0,
const SourceRange *Ranges = 0, unsigned NumRanges = 0);
const SourceRange *Ranges = 0, unsigned NumRanges = 0) {
Report(NULL, Pos, DiagID, Strs, NumStrs, Ranges, NumRanges);
}
/// Report - Issue the message to the client. DiagID is a member of the
/// diag::kind enum.
void Report(unsigned DiagID,
const std::string *Strs = 0, unsigned NumStrs = 0,
const SourceRange *Ranges = 0, unsigned NumRanges = 0) {
Report(FullSourceLoc(),DiagID,Strs,NumStrs,Ranges,NumRanges);
Report(FullSourceLoc(), DiagID, Strs, NumStrs, Ranges, NumRanges);
}
/// Report - Issue the message to the specified client.
/// DiagID is a member of the diag::kind enum.
void Report(DiagnosticClient* C, FullSourceLoc Pos, unsigned DiagID,
const std::string *Strs = 0, unsigned NumStrs = 0,
const SourceRange *Ranges = 0, unsigned NumRanges = 0);
};
/// DiagnosticClient - This is an abstract interface implemented by clients of

Просмотреть файл

@ -198,7 +198,8 @@ Diagnostic::Level Diagnostic::getDiagnosticLevel(unsigned DiagID) const {
/// Report - Issue the message to the client. If the client wants us to stop
/// compilation, return true, otherwise return false. DiagID is a member of
/// the diag::kind enum.
void Diagnostic::Report(FullSourceLoc Pos, unsigned DiagID,
void Diagnostic::Report(DiagnosticClient* C,
FullSourceLoc Pos, unsigned DiagID,
const std::string *Strs, unsigned NumStrs,
const SourceRange *Ranges, unsigned NumRanges) {
@ -224,8 +225,11 @@ void Diagnostic::Report(FullSourceLoc Pos, unsigned DiagID,
}
// Finally, report it.
Client.HandleDiagnostic(*this, DiagLevel, Pos, (diag::kind)DiagID,
Strs, NumStrs, Ranges, NumRanges);
if (!C) C = &Client;
C->HandleDiagnostic(*this, DiagLevel, Pos, (diag::kind)DiagID,
Strs, NumStrs, Ranges, NumRanges);
++NumDiagnostics;
}