[llvm-branch-commits] [cfe-branch] r119415 - in /cfe/branches/Apple/whitney: lib/Frontend/ASTUnit.cpp tools/c-index-test/c-index-test.c
Daniel Dunbar
daniel at zuster.org
Tue Nov 16 16:23:25 PST 2010
Author: ddunbar
Date: Tue Nov 16 18:23:24 2010
New Revision: 119415
URL: http://llvm.org/viewvc/llvm-project?rev=119415&view=rev
Log:
Merge r119285:
--
Author: Douglas Gregor <dgregor at apple.com>
Date: Mon Nov 15 23:00:34 2010 +0000
Tweak libclang's heuristics for building precompiled preambles and
caching global code-completion results. In particular, don't perform
either operation the first time we parse, but do both after the first
reparse.
Modified:
cfe/branches/Apple/whitney/lib/Frontend/ASTUnit.cpp
cfe/branches/Apple/whitney/tools/c-index-test/c-index-test.c
Modified: cfe/branches/Apple/whitney/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Frontend/ASTUnit.cpp?rev=119415&r1=119414&r2=119415&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Frontend/ASTUnit.cpp Tue Nov 16 18:23:24 2010
@@ -336,7 +336,6 @@
// Make a note of the state when we performed this caching.
NumTopLevelDeclsAtLastCompletionCache = top_level_size();
- CacheCodeCompletionCoolDown = 15;
}
void ASTUnit::ClearCachedCompletionResults() {
@@ -834,12 +833,6 @@
}
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:
@@ -1361,7 +1354,7 @@
llvm::MemoryBuffer *OverrideMainBuffer = 0;
if (PrecompilePreamble) {
- PreambleRebuildCounter = 1;
+ PreambleRebuildCounter = 2;
OverrideMainBuffer
= getMainBufferWithPrecompiledPreamble(*Invocation);
}
@@ -1389,6 +1382,7 @@
AST->CaptureDiagnostics = CaptureDiagnostics;
AST->CompleteTranslationUnit = CompleteTranslationUnit;
AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
+ AST->CacheCodeCompletionCoolDown = 1;
AST->Invocation.reset(CI);
return AST->LoadFromCompilerInvocation(PrecompilePreamble)? 0 : AST.take();
@@ -1493,6 +1487,7 @@
AST->CaptureDiagnostics = CaptureDiagnostics;
AST->CompleteTranslationUnit = CompleteTranslationUnit;
AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
+ AST->CacheCodeCompletionCoolDown = 1;
AST->NumStoredDiagnosticsFromDriver = StoredDiagnostics.size();
AST->NumStoredDiagnosticsInPreamble = StoredDiagnostics.size();
AST->StoredDiagnostics.swap(StoredDiagnostics);
Modified: cfe/branches/Apple/whitney/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/tools/c-index-test/c-index-test.c?rev=119415&r1=119414&r2=119415&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/c-index-test/c-index-test.c (original)
+++ cfe/branches/Apple/whitney/tools/c-index-test/c-index-test.c Tue Nov 16 18:23:24 2010
@@ -1040,6 +1040,11 @@
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,
More information about the llvm-branch-commits
mailing list