aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-31 07:20:19 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-31 07:20:19 +0000
commit092294918b5649cac05d6442aae75f7904ef772e (patch)
treee377c02c405a62b0d7196cb8264a401d08282de5 /lib/Frontend
parentef23b6001e8d9715246ca23bd8c3a6887d7844cb (diff)
Move caching of code-completion results from ASTUnit::Reparse to ASTUnit::CodeComplete,
so that it will happen when we are doing code-completion, not reparsing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143342 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 7211ca6dce..cb52a2f349 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -1942,12 +1942,6 @@ bool ASTUnit::Reparse(RemappedFile *RemappedFiles, unsigned NumRemappedFiles) {
// Parse the sources
bool Result = Parse(OverrideMainBuffer);
-
- // If we're caching global code-completion results, and the top-level
- // declarations have changed, clear out the code-completion cache.
- if (!Result && ShouldCacheCodeCompletionResults &&
- CurrentTopLevelHashValue != CompletionCacheTopLevelHashValue)
- CacheCodeCompletionResults();
// We now need to clear out the completion allocator for
// clang_getCursorCompletionString; it'll be recreated if necessary.
@@ -2207,6 +2201,12 @@ void ASTUnit::CodeComplete(StringRef File, unsigned Line, unsigned Column,
SmallVectorImpl<const llvm::MemoryBuffer *> &OwnedBuffers) {
if (!Invocation)
return;
+
+ // If we're caching global code-completion results, and the top-level
+ // declarations have changed, clear out the code-completion cache.
+ if (ShouldCacheCodeCompletionResults &&
+ CurrentTopLevelHashValue != CompletionCacheTopLevelHashValue)
+ CacheCodeCompletionResults();
SimpleTimer CompletionTimer(WantTiming);
CompletionTimer.setOutput("Code completion @ " + File + ":" +