diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-03-31 18:23:15 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-03-31 18:23:15 +0000 |
commit | 615f5177095e62b36bf88f1b1b7b644295e4097b (patch) | |
tree | 8de14a0704d1ac13c3c1f4527a03f1e8dd124127 | |
parent | f186f303ee0519d48a1bca24b7a9f4ad503bd5b2 (diff) |
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
-rw-r--r-- | include/clang/Basic/Diagnostic.h | 12 | ||||
-rw-r--r-- | lib/Basic/Diagnostic.cpp | 10 |
2 files changed, 17 insertions, 5 deletions
diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index 35a3266093..2b6528b868 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -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 diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp index f62b8f126c..867b3dbec1 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/lib/Basic/Diagnostic.cpp @@ -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; } |