summaryrefslogtreecommitdiffstats
path: root/clang/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
commit1b544e3cf03006333e8c95af8d89ea6505546120 (patch)
tree874d460f3d7552ad497e6974ce5fd05599c0dfba /clang/lib/Frontend
parent6fb6003aad61169a5bd7eb4b85fa7e93a986333d (diff)
downloadbcm5719-llvm-1b544e3cf03006333e8c95af8d89ea6505546120.tar.gz
bcm5719-llvm-1b544e3cf03006333e8c95af8d89ea6505546120.zip
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. llvm-svn: 143342
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 7211ca6dce2..cb52a2f3496 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/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 + ":" +
OpenPOWER on IntegriCloud