summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/ASTUnit.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-31 21:25:31 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-31 21:25:31 +0000
commit3689337c8e26fee4dcbdda478ebb6a88ce904069 (patch)
treeca3a328a2fd5a3418bbd5e63efa9860997b8a332 /clang/lib/Frontend/ASTUnit.cpp
parentaff3640d13685bf5267908b2eb9350e1a68644a1 (diff)
downloadbcm5719-llvm-3689337c8e26fee4dcbdda478ebb6a88ce904069.tar.gz
bcm5719-llvm-3689337c8e26fee4dcbdda478ebb6a88ce904069.zip
Revert r143342. Caching of code-completion results was intentionally placed in "reparse"
because we don't want to take this performance hit when doing code completion Log of r143342: 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: 143367
Diffstat (limited to 'clang/lib/Frontend/ASTUnit.cpp')
-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 cb52a2f3496..7211ca6dce2 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -1942,6 +1942,12 @@ 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.
@@ -2201,12 +2207,6 @@ 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