From: Douglas Gregor Date: Thu, 9 Dec 2010 21:27:43 +0000 (+0000) Subject: Gather cached code completions after the first reparse, not after the X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d64f4c14029f970caafb0bdfcf07f9fecfe5c68b;p=clang Gather cached code completions after the first reparse, not after the second reparse. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121413 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 97e03266eb..d042f3fb85 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -848,6 +848,14 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *OverrideMainBuffer) { } Invocation.reset(Clang.takeInvocation()); + + if (ShouldCacheCodeCompletionResults) { + if (CacheCodeCompletionCoolDown > 0) + --CacheCodeCompletionCoolDown; + else if (top_level_size() != NumTopLevelDeclsAtLastCompletionCache) + CacheCodeCompletionResults(); + } + return false; error: @@ -1586,14 +1594,6 @@ bool ASTUnit::Reparse(RemappedFile *RemappedFiles, unsigned NumRemappedFiles) { // Parse the sources bool Result = Parse(OverrideMainBuffer); - - if (ShouldCacheCodeCompletionResults) { - if (CacheCodeCompletionCoolDown > 0) - --CacheCodeCompletionCoolDown; - else if (top_level_size() != NumTopLevelDeclsAtLastCompletionCache) - CacheCodeCompletionResults(); - } - return Result; }