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 | 811db4eac4e036de3705570a46e28bf7d993dbab (patch) | |
tree | a3c03c187e25f995d854d175faaa3d793f12bee1 /clang/tools/driver/driver.cpp | |
parent | 7fcf0c131bc198de245e65f35b380af02b085dde (diff) | |
download | bcm5719-llvm-811db4eac4e036de3705570a46e28bf7d993dbab.tar.gz bcm5719-llvm-811db4eac4e036de3705570a46e28bf7d993dbab.zip |
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.
llvm-svn: 166508
Diffstat (limited to 'clang/tools/driver/driver.cpp')
-rw-r--r-- | clang/tools/driver/driver.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp index 12a93298c08..81979ec7268 100644 --- a/clang/tools/driver/driver.cpp +++ b/clang/tools/driver/driver.cpp @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#include "clang/Basic/DiagnosticOptions.h" #include "clang/Driver/ArgList.h" #include "clang/Driver/Options.h" #include "clang/Driver/Compilation.h" @@ -19,7 +20,6 @@ #include "clang/Driver/Option.h" #include "clang/Driver/OptTable.h" #include "clang/Frontend/CompilerInvocation.h" -#include "clang/Frontend/DiagnosticOptions.h" #include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/Frontend/Utils.h" @@ -375,7 +375,7 @@ int main(int argc_, const char **argv_) { llvm::sys::Path Path = GetExecutablePath(argv[0], CanonicalPrefixes); - DiagnosticOptions DiagOpts; + IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions; { // Note that ParseDiagnosticArgs() uses the cc1 option table. OwningPtr<OptTable> CC1Opts(createDriverOptTable()); @@ -385,17 +385,17 @@ int main(int argc_, const char **argv_) { // We ignore MissingArgCount and the return value of ParseDiagnosticArgs. // Any errors that would be diagnosed here will also be diagnosed later, // when the DiagnosticsEngine actually exists. - (void) ParseDiagnosticArgs(DiagOpts, *Args); + (void) ParseDiagnosticArgs(*DiagOpts, *Args); } // Now we can create the DiagnosticsEngine with a properly-filled-out // DiagnosticOptions instance. TextDiagnosticPrinter *DiagClient - = new TextDiagnosticPrinter(llvm::errs(), DiagOpts); + = new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts); DiagClient->setPrefix(llvm::sys::path::stem(Path.str())); IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); - DiagnosticsEngine Diags(DiagID, DiagClient); - ProcessWarningOptions(Diags, DiagOpts); + DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagClient); + ProcessWarningOptions(Diags, *DiagOpts); #ifdef CLANG_IS_PRODUCTION const bool IsProduction = true; |