]> granicus.if.org Git - clang/commitdiff
When performing code completion within ASTUnit, allocate the AugmentedCodeCompleteCon...
authorDouglas Gregor <dgregor@apple.com>
Mon, 29 Nov 2010 16:13:56 +0000 (16:13 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 29 Nov 2010 16:13:56 +0000 (16:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120290 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/ASTUnit.cpp

index b55001e2b1bf652fb17e504923f7e2a13d8ded3b..09403620ac71ca4ea5dee1f930623212f408844e 100644 (file)
@@ -1841,11 +1841,12 @@ void ASTUnit::CodeComplete(llvm::StringRef File, unsigned Line, unsigned Column,
   
   // Use the code completion consumer we were given, but adding any cached
   // code-completion results.
-  AugmentedCodeCompleteConsumer 
-  AugmentedConsumer(*this, Consumer, FrontendOpts.ShowMacrosInCodeCompletion,
-                    FrontendOpts.ShowCodePatternsInCodeCompletion,
-                    FrontendOpts.ShowGlobalSymbolsInCodeCompletion);
-  Clang.setCodeCompletionConsumer(&AugmentedConsumer);
+  AugmentedCodeCompleteConsumer *AugmentedConsumer
+    = new AugmentedCodeCompleteConsumer(*this, Consumer, 
+                                        FrontendOpts.ShowMacrosInCodeCompletion,
+                                FrontendOpts.ShowCodePatternsInCodeCompletion,
+                                FrontendOpts.ShowGlobalSymbolsInCodeCompletion);
+  Clang.setCodeCompletionConsumer(AugmentedConsumer);
 
   // If we have a precompiled preamble, try to use it. We only allow
   // the use of the precompiled preamble if we're if the completion
@@ -1906,7 +1907,6 @@ void ASTUnit::CodeComplete(llvm::StringRef File, unsigned Line, unsigned Column,
   Clang.takeFileManager();
   Clang.takeSourceManager();
   Clang.takeInvocation();
-  Clang.takeCodeCompletionConsumer();
 }
 
 bool ASTUnit::Save(llvm::StringRef File) {