]> granicus.if.org Git - clang/commitdiff
Gather cached code completions after the first reparse, not after the
authorDouglas Gregor <dgregor@apple.com>
Thu, 9 Dec 2010 21:27:43 +0000 (21:27 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 9 Dec 2010 21:27:43 +0000 (21:27 +0000)
second reparse.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121413 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/ASTUnit.cpp

index 97e03266ebe06d1efb48cc91d4ee6443986c39c7..d042f3fb857794e14ac4498ee6dbd40bfb84108b 100644 (file)
@@ -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;
 }