From: Argyrios Kyrtzidis Date: Mon, 31 Oct 2011 21:25:31 +0000 (+0000) Subject: Revert r143342. Caching of code-completion results was intentionally placed in "reparse" X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2fe17fc5ead5e42ef195618228bca53c79e0e50d;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143367 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index cb52a2f349..7211ca6dce 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/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 &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 + ":" +