[PATCH] D48917: [SemaCodeComplete] Make sure visited contexts are passed to completion results handler.

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 4 02:20:39 PDT 2018


ioeric added inline comments.


================
Comment at: lib/Sema/SemaCodeComplete.cpp:3744
     AddMacroResults(PP, Results, false, PreferredTypeIsPointer);
-  HandleCodeCompleteResults(this, CodeCompleter, 
-                CodeCompletionContext(CodeCompletionContext::CCC_Expression, 
----------------
ilya-biryukov wrote:
> `ResultsBuilder`'s constructor accepts a `CodeCompletionContext`. Can we pass in the context with `PreferedType` there instead of reconstructing it later?
> To make sure we don't miss other things (incl. any future additions) that `ResultsBuilder` puts into the context.
The `PreferedType` should actually already be set in the `ResultsBuilder` (line 3715). In thoery, `Results.getCompletionContext()` should work fine here as well, but it would break some Index tests - it introduced some inconsistency in sema scoring when running with and without result caching (https://github.com/llvm-mirror/clang/blob/master/test/Index/complete-exprs.c#L35). This is probably a bug, but I'm not sure if I'm the right person to chase it :( 


Repository:
  rC Clang

https://reviews.llvm.org/D48917





More information about the cfe-commits mailing list