diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-11-12 00:24:28 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-11-12 00:24:28 +0000 |
commit | c8daaa45130015c93cd0f9145799d07060f665fc (patch) | |
tree | a3aa887a52d89470d8b277c4b4caec13525cedc3 | |
parent | 5746f1ff6286f5e5bd7fc28e5e2031f18e4676c9 (diff) |
Tweak formatting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86907 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/clang-cc/clang-cc.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp index 9ef0877456..784b19e61c 100644 --- a/tools/clang-cc/clang-cc.cpp +++ b/tools/clang-cc/clang-cc.cpp @@ -217,14 +217,14 @@ CodeCompletionWantsMacros("code-completion-macros", static CodeCompleteConsumer *BuildPrintingCodeCompleter(Sema &S, void *) { switch (CodeCompletionPrinter.getValue()) { case CCP_Debug: - return new PrintingCodeCompleteConsumer(S, CodeCompletionWantsMacros, + return new PrintingCodeCompleteConsumer(S, CodeCompletionWantsMacros, llvm::outs()); - + case CCP_CIndex: return new CIndexCodeCompleteConsumer(S, CodeCompletionWantsMacros, llvm::outs()); }; - + return 0; } @@ -890,18 +890,15 @@ static void ProcessInputFile(const CompilerInvocation &CompOpts, if (FixItRewrite) FixItRewrite->WriteFixedFile(InFile, CompOpts.getOutputFile()); - // Disable the consumer prior to the context, the consumer may perform actions - // in its destructor which require the context. - if (DisableFree) + // Release the consumer and the AST, in that order since the consumer may + // perform actions in its destructor which require the context. + if (DisableFree) { Consumer.take(); - else - Consumer.reset(); - - // If in -disable-free mode, don't deallocate ASTContext. - if (DisableFree) ContextOwner.take(); - else - ContextOwner.reset(); // Delete ASTContext + } else { + Consumer.reset(); + ContextOwner.reset(); + } if (VerifyDiagnostics) if (CheckDiagnostics(PP)) @@ -948,10 +945,9 @@ static void ProcessASTInputFile(const CompilerInvocation &CompOpts, llvm::OwningPtr<llvm::raw_ostream> OS; llvm::sys::Path OutPath; - llvm::OwningPtr<ASTConsumer> Consumer(CreateConsumerAction(CompOpts, PP, + llvm::OwningPtr<ASTConsumer> Consumer(CreateConsumerAction(CompOpts, PP, InFile, PA, OS, OutPath, Context)); - if (!Consumer.get()) { Diags.Report(diag::err_fe_invalid_ast_action); return; |