[cfe-commits] r86907 - /cfe/trunk/tools/clang-cc/clang-cc.cpp
Daniel Dunbar
daniel at zuster.org
Wed Nov 11 16:24:28 PST 2009
Author: ddunbar
Date: Wed Nov 11 18:24:28 2009
New Revision: 86907
URL: http://llvm.org/viewvc/llvm-project?rev=86907&view=rev
Log:
Tweak formatting.
Modified:
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=86907&r1=86906&r2=86907&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Wed Nov 11 18:24:28 2009
@@ -217,14 +217,14 @@
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 @@
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 @@
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;
More information about the cfe-commits
mailing list