diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-10-23 22:26:28 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-10-23 22:26:28 +0000 |
commit | 02c23ebf41ae2f70da0ba7337e05c51fbfe35f7f (patch) | |
tree | c44af66edb700be2df3d1ad41420df5c7174d5f1 /tools/diagtool | |
parent | 340d0d30018dd3ed77fb17f33e785acd745bf97d (diff) |
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
Diffstat (limited to 'tools/diagtool')
-rw-r--r-- | tools/diagtool/ShowEnabledWarnings.cpp | 4 | ||||
-rw-r--r-- | tools/diagtool/TreeView.cpp | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/tools/diagtool/ShowEnabledWarnings.cpp b/tools/diagtool/ShowEnabledWarnings.cpp index 7162451b4e..abd69fd0af 100644 --- a/tools/diagtool/ShowEnabledWarnings.cpp +++ b/tools/diagtool/ShowEnabledWarnings.cpp @@ -60,7 +60,7 @@ createDiagnostics(unsigned int argc, char **argv) { // 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 @@ createDiagnostics(unsigned int argc, char **argv) { // Build the diagnostics parser IntrusiveRefCntPtr<DiagnosticsEngine> FinalDiags = - CompilerInstance::createDiagnostics(Invocation->getDiagnosticOpts(), + CompilerInstance::createDiagnostics(&Invocation->getDiagnosticOpts(), argc, argv); if (!FinalDiags) return NULL; diff --git a/tools/diagtool/TreeView.cpp b/tools/diagtool/TreeView.cpp index aee7554151..bf9f766c30 100644 --- a/tools/diagtool/TreeView.cpp +++ b/tools/diagtool/TreeView.cpp @@ -14,6 +14,7 @@ #include "DiagTool.h" #include "DiagnosticNames.h" #include "clang/Basic/Diagnostic.h" +#include "clang/Basic/DiagnosticOptions.h" #include "llvm/Support/Format.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/DenseSet.h" @@ -50,7 +51,9 @@ static void resetColor(bool ShowColors, llvm::raw_ostream &out) { } static clang::DiagnosticsEngine::Level getLevel(unsigned DiagID) { - static clang::DiagnosticsEngine Diags(new DiagnosticIDs); + // FIXME: This feels like a hack. + static clang::DiagnosticsEngine Diags(new DiagnosticIDs, + new DiagnosticOptions); return Diags.getDiagnosticLevel(DiagID, SourceLocation()); } |