// Make a note of the state when we performed this caching.
NumTopLevelDeclsAtLastCompletionCache = top_level_size();
- CacheCodeCompletionCoolDown = 15;
}
void ASTUnit::ClearCachedCompletionResults() {
}
Invocation.reset(Clang.takeInvocation());
-
- // If we were asked to cache code-completion results and don't have any
- // results yet, do so now.
- if (ShouldCacheCodeCompletionResults && CachedCompletionResults.empty())
- CacheCodeCompletionResults();
-
return false;
error:
llvm::MemoryBuffer *OverrideMainBuffer = 0;
if (PrecompilePreamble) {
- PreambleRebuildCounter = 1;
+ PreambleRebuildCounter = 2;
OverrideMainBuffer
= getMainBufferWithPrecompiledPreamble(*Invocation);
}
AST->CaptureDiagnostics = CaptureDiagnostics;
AST->CompleteTranslationUnit = CompleteTranslationUnit;
AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
+ AST->CacheCodeCompletionCoolDown = 1;
AST->Invocation.reset(CI);
return AST->LoadFromCompilerInvocation(PrecompilePreamble)? 0 : AST.take();
AST->CaptureDiagnostics = CaptureDiagnostics;
AST->CompleteTranslationUnit = CompleteTranslationUnit;
AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
+ AST->CacheCodeCompletionCoolDown = 1;
AST->NumStoredDiagnosticsFromDriver = StoredDiagnostics.size();
AST->NumStoredDiagnosticsInPreamble = StoredDiagnostics.size();
AST->StoredDiagnostics.swap(StoredDiagnostics);
fprintf(stderr, "Unable to load translation unit!\n");
return 1;
}
+
+ if (clang_reparseTranslationUnit(TU, 0, 0, clang_defaultReparseOptions(TU))) {
+ fprintf(stderr, "Unable to reparse translation init!\n");
+ return 1;
+ }
for (I = 0; I != Repeats; ++I) {
results = clang_codeCompleteAt(TU, filename, line, column,