aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-11-29 16:13:56 +0000
committerDouglas Gregor <dgregor@apple.com>2010-11-29 16:13:56 +0000
commit7f946ad40877df749ad05392cc4b80dc4189d28f (patch)
treeb0e82569bcdf8ea9fd163562f3bf2b692ae20084 /lib/Frontend
parent0629cbe86b6d890076548778ed8597ee298adcba (diff)
When performing code completion within ASTUnit, allocate the AugmentedCodeCompleteConsumer on the heap, so it's always cleaned up properly
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120290 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend')
-rw-r--r--lib/Frontend/ASTUnit.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index b55001e2b1..09403620ac 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -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) {