Make DiagnosticOptions intrusively reference-counted, and make sure
the various stakeholders bump up the reference count. In particular,
the diagnostics engine now keeps the DiagnosticOptions object alive.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166508 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/diagtool/ShowEnabledWarnings.cpp b/tools/diagtool/ShowEnabledWarnings.cpp
index 7162451..abd69fd 100644
--- a/tools/diagtool/ShowEnabledWarnings.cpp
+++ b/tools/diagtool/ShowEnabledWarnings.cpp
@@ -60,7 +60,7 @@
// well formed diagnostic object.
TextDiagnosticBuffer *DiagsBuffer = new TextDiagnosticBuffer;
IntrusiveRefCntPtr<DiagnosticsEngine> InterimDiags(
- new DiagnosticsEngine(DiagIDs, DiagsBuffer));
+ new DiagnosticsEngine(DiagIDs, new DiagnosticOptions(), DiagsBuffer));
// Try to build a CompilerInvocation.
OwningPtr<CompilerInvocation> Invocation(
@@ -71,7 +71,7 @@
// Build the diagnostics parser
IntrusiveRefCntPtr<DiagnosticsEngine> FinalDiags =
- CompilerInstance::createDiagnostics(Invocation->getDiagnosticOpts(),
+ CompilerInstance::createDiagnostics(&Invocation->getDiagnosticOpts(),
argc, argv);
if (!FinalDiags)
return NULL;