[cfe-commits] r143342 - /cfe/trunk/lib/Frontend/ASTUnit.cpp

Argyrios Kyrtzidis kyrtzidis at apple.com
Mon Oct 31 14:29:36 PDT 2011


On Oct 31, 2011, at 9:19 AM, Douglas Gregor wrote:

> 
> On Oct 31, 2011, at 12:20 AM, Argyrios Kyrtzidis wrote:
> 
>> Author: akirtzidis
>> Date: Mon Oct 31 02:20:19 2011
>> New Revision: 143342
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=143342&view=rev
>> Log:
>> Move caching of code-completion results from ASTUnit::Reparse to ASTUnit::CodeComplete,
>> so that it will happen when we are doing code-completion, not reparsing.
> 
> Why?

The rationale was to avoid deserializing all global decls when reparsing.

Reverted in r143367; on the lookout for another solution.

> The caching of code-completion results was intentionally placed in "reparse" because we don't want to take this performance hit when doing code completion (which is the most critical operation for UI responsiveness).
> 
> 	- Doug
> 
>> Modified:
>>   cfe/trunk/lib/Frontend/ASTUnit.cpp
>> 
>> Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=143342&r1=143341&r2=143342&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
>> +++ cfe/trunk/lib/Frontend/ASTUnit.cpp Mon Oct 31 02:20:19 2011
>> @@ -1942,12 +1942,6 @@
>> 
>>  // Parse the sources
>>  bool Result = Parse(OverrideMainBuffer);
>> -  
>> -  // If we're caching global code-completion results, and the top-level 
>> -  // declarations have changed, clear out the code-completion cache.
>> -  if (!Result && ShouldCacheCodeCompletionResults &&
>> -      CurrentTopLevelHashValue != CompletionCacheTopLevelHashValue)
>> -    CacheCodeCompletionResults();
>> 
>>  // We now need to clear out the completion allocator for
>>  // clang_getCursorCompletionString; it'll be recreated if necessary.
>> @@ -2207,6 +2201,12 @@
>>             SmallVectorImpl<const llvm::MemoryBuffer *> &OwnedBuffers) {
>>  if (!Invocation)
>>    return;
>> +  
>> +  // If we're caching global code-completion results, and the top-level 
>> +  // declarations have changed, clear out the code-completion cache.
>> +  if (ShouldCacheCodeCompletionResults &&
>> +      CurrentTopLevelHashValue != CompletionCacheTopLevelHashValue)
>> +    CacheCodeCompletionResults();
>> 
>>  SimpleTimer CompletionTimer(WantTiming);
>>  CompletionTimer.setOutput("Code completion @ " + File + ":" +
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 




More information about the cfe-commits mailing list