etyloppihacilem wrote:

I decided to use `Parser::ParseDeclaratorInternal` as a criteria to detect 
declaration context, it works great and was way easier than my previous 
approach.


I had to fix another issue where static and non-static member functions were 
mixed in the completion results. I now detect if a call occurs within a scope 
resolution context (::) to treat non-static functions like pointers, i.e., no 
completion (matches the behavior before my patch). This distinction is clearly 
visible here:
```cpp
struct Foo {
  template <typename T, typename U, typename V = int>
  T generic(U nameU, V nameV);
};

int i = Foo::^
// would complete
int i = Foo::generic<typename T, typename U>(U nameU, V nameV) // with 
placeholders
// which is incorrect because in a call context, we do not want 'typename U'
// and the call context is incorrect anyway

// it now complete, as it did before
int i = Foo::generic

// while
int main() {
  Foo f;
  f.^
  // completes
  f.generic<typename T>(U nameU, V nameV) // with placeholders as well.
}
```

https://github.com/llvm/llvm-project/pull/165916
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to