<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br><br>Sent from my iPhone</div><div><br>On Nov 18, 2015, at 8:19 AM, Manuel Klimek <<a href="mailto:klimek@google.com">klimek@google.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_quote"><div>(now with the right list)</div><div><br></div><div dir="ltr">On Tue, Nov 16, 2010 at 12:03 AM Douglas Gregor <<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dgregor<br>
Date: Mon Nov 15 17:00:34 2010<br>
New Revision: 119285<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=119285&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=119285&view=rev</a><br>
Log:<br>
Tweak libclang's heuristics for building precompiled preambles and<br>
caching global code-completion results. In particular, don't perform<br>
either operation the first time we parse, but do both after the first<br>
reparse.<br></blockquote><div><br></div><div style="font-size:13px;line-height:19.5px">Do you remember the reason behind not building the preamble on the first parse? For really large TUs having to parse 2 times before we get a preamble is rather painful.</div></div></div></div></blockquote><div><br></div>We wanted to get the first set of results quickly, especially for syntax coloring when a file is first opened. <div><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_quote"><div style="font-size:13px;line-height:19.5px"><br></div><div style="font-size:13px;line-height:19.5px">Cheers,</div><div><span style="font-size:13px;line-height:19.5px">/Manuel</span> </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
cfe/trunk/lib/Frontend/ASTUnit.cpp<br>
cfe/trunk/tools/c-index-test/c-index-test.c<br>
<br>
Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=119285&r1=119284&r2=119285&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=119285&r1=119284&r2=119285&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)<br>
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Mon Nov 15 17:00:34 2010<br>
@@ -326,7 +326,6 @@<br>
<br>
// Make a note of the state when we performed this caching.<br>
NumTopLevelDeclsAtLastCompletionCache = top_level_size();<br>
- CacheCodeCompletionCoolDown = 15;<br>
}<br>
<br>
void ASTUnit::ClearCachedCompletionResults() {<br>
@@ -824,12 +823,6 @@<br>
}<br>
<br>
Invocation.reset(Clang.takeInvocation());<br>
-<br>
- // If we were asked to cache code-completion results and don't have any<br>
- // results yet, do so now.<br>
- if (ShouldCacheCodeCompletionResults && CachedCompletionResults.empty())<br>
- CacheCodeCompletionResults();<br>
-<br>
return false;<br>
<br>
error:<br>
@@ -1350,7 +1343,7 @@<br>
<br>
llvm::MemoryBuffer *OverrideMainBuffer = 0;<br>
if (PrecompilePreamble) {<br>
- PreambleRebuildCounter = 1;<br>
+ PreambleRebuildCounter = 2;<br>
OverrideMainBuffer<br>
= getMainBufferWithPrecompiledPreamble(*Invocation);<br>
}<br>
@@ -1377,6 +1370,7 @@<br>
AST->CaptureDiagnostics = CaptureDiagnostics;<br>
AST->CompleteTranslationUnit = CompleteTranslationUnit;<br>
AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;<br>
+ AST->CacheCodeCompletionCoolDown = 1;<br>
AST->Invocation.reset(CI);<br>
<br>
return AST->LoadFromCompilerInvocation(PrecompilePreamble)? 0 : AST.take();<br>
@@ -1481,6 +1475,7 @@<br>
AST->CaptureDiagnostics = CaptureDiagnostics;<br>
AST->CompleteTranslationUnit = CompleteTranslationUnit;<br>
AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;<br>
+ AST->CacheCodeCompletionCoolDown = 1;<br>
AST->NumStoredDiagnosticsFromDriver = StoredDiagnostics.size();<br>
AST->NumStoredDiagnosticsInPreamble = StoredDiagnostics.size();<br>
AST->StoredDiagnostics.swap(StoredDiagnostics);<br>
<br>
Modified: cfe/trunk/tools/c-index-test/c-index-test.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=119285&r1=119284&r2=119285&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=119285&r1=119284&r2=119285&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)<br>
+++ cfe/trunk/tools/c-index-test/c-index-test.c Mon Nov 15 17:00:34 2010<br>
@@ -1040,6 +1040,11 @@<br>
fprintf(stderr, "Unable to load translation unit!\n");<br>
return 1;<br>
}<br>
+<br>
+ if (clang_reparseTranslationUnit(TU, 0, 0, clang_defaultReparseOptions(TU))) {<br>
+ fprintf(stderr, "Unable to reparse translation init!\n");<br>
+ return 1;<br>
+ }<br>
<br>
for (I = 0; I != Repeats; ++I) {<br>
results = clang_codeCompleteAt(TU, filename, line, column,<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div>
</div></blockquote></div></body></html>