tom-anders added inline comments.

================
Comment at: clang-tools-extra/clangd/CodeComplete.cpp:1993
         Builder.emplace(Recorder ? &Recorder->CCSema->getASTContext() : 
nullptr,
-                        Item, SemaCCS, QueryScopes, *Inserter, FileName,
+                        Recorder ? Recorder->CCSema->CurContext : nullptr, 
Item,
+                        SemaCCS, QueryScopes, *Inserter, FileName,
----------------
tom-anders wrote:
> kadircet wrote:
> > instead of passing it here, can we just do the traversal as part of 
> > `getQueryScopes` and let these be handled uniformly by the shortest 
> > qualifier logic ?
> Yeah that was my initial idea, however the problem is that it looses the 
> information about whether the enum is scoped or not:
> 1) QueryScopes only stores strings
> 2) The index has no flag for indicating whether an EnumConstant belongs to a 
> scoped or unscoped enum
> 
> Thus, we get a small problem, consider the following code:
> 
> ```
> namespace ns {
> enum class Scoped { Foo };
> enum class Unscoped { Bar };
> }
> 
> int main() {
>     using ns::Scoped;
>     using ns::Unscoped;
> 
>     Foo^
>     Bar^
> }
> ```
> Here we want to complete Foo^ to ns::Scoped::Foo, but for Bar^ we want only 
> ns::Bar. To resolve this, the scoped/unscoped information needs to be 
> available when building the completion candidate. 
> 
> Hope this was clear, maybe I missed something.
Sorry, I meant the completion for Foo^ should be Scoped::Foo here, not 
ns::Scoped::Foo.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141800/new/

https://reviews.llvm.org/D141800

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to