[cfe-commits] r48986 - in /cfe/trunk: include/clang/Basic/Diagnostic.h lib/Basic/Diagnostic.cpp
Ted Kremenek
kremenek at apple.com
Mon Mar 31 11:23:16 PDT 2008
Author: kremenek
Date: Mon Mar 31 13:23:15 2008
New Revision: 48986
URL: http://llvm.org/viewvc/llvm-project?rev=48986&view=rev
Log:
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.
Modified:
cfe/trunk/include/clang/Basic/Diagnostic.h
cfe/trunk/lib/Basic/Diagnostic.cpp
Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=48986&r1=48985&r2=48986&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Mon Mar 31 13:23:15 2008
@@ -149,15 +149,23 @@
/// 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
Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=48986&r1=48985&r2=48986&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Mon Mar 31 13:23:15 2008
@@ -198,7 +198,8 @@
/// 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 @@
}
// 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;
}
More information about the cfe-commits
mailing list