ilya-biryukov added inline comments.

================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:181
+      addToken(E->getMemberLoc(), E->getQualifier()
+                                      ? HighlightingKind::StaticField
+                                      : HighlightingKind::Field);
----------------
nridge wrote:
> hokein wrote:
> > This could be member functions, a case is like
> > 
> > ```
> > template<class T>
> > class Foo {
> > public:
> >   void foo() {
> >     this->foo();
> >   }
> > };
> > ```
> Thanks for the example.
> 
> Do you have a suggestion for how to discriminate this case? To me, it would 
> seem logical to do it based on syntax (highlight as a member function if the 
> expression forms the function name of a function call expression). That would 
> require navigating from the expression to its parent node. Is there a way to 
> do that?
There is no way to do this in C++.
Even if the name is followed by a pair of parenthese, this could either be a 
field with overloaded `operator()` (e.g. a `std::function<void()> field`) or a 
function with the same name.

It's much better to pick a separate highlighting kind for dependent names, this 
follows the actual semantics of C++.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67901



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

Reply via email to