aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Basic/Diagnostic.h12
-rw-r--r--lib/Basic/Diagnostic.cpp10
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;
}