aboutsummaryrefslogtreecommitdiff
path: root/tools/driver/cc1_main.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-08-18 22:29:43 +0000
committerDouglas Gregor <dgregor@apple.com>2010-08-18 22:29:43 +0000
commitbdbb004f38978da0c4a75af3294d1c7b5ff84af1 (patch)
tree2e24b7d4abc8238b26ee74eb8e669e066b6e2997 /tools/driver/cc1_main.cpp
parent421649bacb78b3d754688bc9214725189900aba6 (diff)
Simplify the ownership model for DiagnosticClients, which was really
convoluted and a bit leaky. Now, the Diagnostic object owns its DiagnosticClient. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111437 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/driver/cc1_main.cpp')
-rw-r--r--tools/driver/cc1_main.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp
index bfdcefbb24..2cab8da24b 100644
--- a/tools/driver/cc1_main.cpp
+++ b/tools/driver/cc1_main.cpp
@@ -121,8 +121,8 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd,
// Run clang -cc1 test.
if (ArgBegin != ArgEnd && llvm::StringRef(ArgBegin[0]) == "-cc1test") {
- TextDiagnosticPrinter DiagClient(llvm::errs(), DiagnosticOptions());
- Diagnostic Diags(&DiagClient);
+ Diagnostic Diags(new TextDiagnosticPrinter(llvm::errs(),
+ DiagnosticOptions()));
return cc1_test(Diags, ArgBegin + 1, ArgEnd);
}
@@ -133,8 +133,8 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd,
// Buffer diagnostics from argument parsing so that we can output them using a
// well formed diagnostic object.
- TextDiagnosticBuffer DiagsBuffer;
- Diagnostic Diags(&DiagsBuffer);
+ TextDiagnosticBuffer *DiagsBuffer = new TextDiagnosticBuffer;
+ Diagnostic Diags(DiagsBuffer);
CompilerInvocation::CreateFromArgs(Clang->getInvocation(), ArgBegin, ArgEnd,
Diags);
@@ -154,7 +154,7 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd,
llvm::install_fatal_error_handler(LLVMErrorHandler,
static_cast<void*>(&Clang->getDiagnostics()));
- DiagsBuffer.FlushDiagnostics(Clang->getDiagnostics());
+ DiagsBuffer->FlushDiagnostics(Clang->getDiagnostics());
// Execute the frontend actions.
bool Success = ExecuteCompilerInvocation(Clang.get());