Fix --html-diags in driver by delaying the construction of an HTMLDiagnosticClient until after we have created the Preprocessor object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54472 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp
index 35d665d..16bdd4a 100644
--- a/lib/Basic/Diagnostic.cpp
+++ b/lib/Basic/Diagnostic.cpp
@@ -108,7 +108,7 @@
// Common Diagnostic implementation
//===----------------------------------------------------------------------===//
-Diagnostic::Diagnostic(DiagnosticClient &client) : Client(client) {
+Diagnostic::Diagnostic(DiagnosticClient *client) : Client(client) {
IgnoreAllWarnings = false;
WarningsAsErrors = false;
WarnOnExtensions = false;
@@ -219,7 +219,7 @@
return;
// Set the diagnostic client if it isn't set already.
- if (!C) C = &Client;
+ if (!C) C = Client;
// If this is not an error and we are in a system header, ignore it. We have
// to check on the original class here, because we also want to ignore
@@ -227,13 +227,13 @@
// warnings/extensions to errors.
if (DiagID < diag::NUM_BUILTIN_DIAGNOSTICS &&
getBuiltinDiagClass(DiagID) != ERROR &&
- Client.isInSystemHeader(Pos))
+ Client->isInSystemHeader(Pos))
return;
if (DiagLevel >= Diagnostic::Error) {
ErrorOccurred = true;
- if (C == &Client)
+ if (C == Client)
++NumErrors;
}
@@ -242,7 +242,7 @@
C->HandleDiagnostic(*this, DiagLevel, Pos, (diag::kind)DiagID,
Strs, NumStrs, Ranges, NumRanges);
- if (C == &Client)
+ if (C == Client)
++NumDiagnostics;
}