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/arcmt-test | |
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/arcmt-test')
-rw-r--r-- | tools/arcmt-test/arcmt-test.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/arcmt-test/arcmt-test.cpp b/tools/arcmt-test/arcmt-test.cpp index 3983c24902..b745893922 100644 --- a/tools/arcmt-test/arcmt-test.cpp +++ b/tools/arcmt-test/arcmt-test.cpp @@ -105,11 +105,12 @@ public: static bool checkForMigration(StringRef resourcesPath, ArrayRef<const char *> Args) { + IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions(); DiagnosticConsumer *DiagClient = - new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions()); + new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts); IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); IntrusiveRefCntPtr<DiagnosticsEngine> Diags( - new DiagnosticsEngine(DiagID, DiagClient)); + new DiagnosticsEngine(DiagID, &*DiagOpts, DiagClient)); // Chain in -verify checker, if requested. VerifyDiagnosticConsumer *verifyDiag = 0; if (VerifyDiags) { @@ -150,11 +151,12 @@ static bool performTransformations(StringRef resourcesPath, if (checkForMigration(resourcesPath, Args)) return true; + IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions(); DiagnosticConsumer *DiagClient = - new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions()); + new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts); IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); IntrusiveRefCntPtr<DiagnosticsEngine> TopDiags( - new DiagnosticsEngine(DiagID, DiagClient)); + new DiagnosticsEngine(DiagID, &*DiagOpts, &*DiagClient)); CompilerInvocation origCI; if (!CompilerInvocation::CreateFromArgs(origCI, Args.begin(), Args.end(), |