[PATCH] D119077: clangd SemanticHighlighting: added support for highlighting overloaded operators
Nathan Ridge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 22 01:12:57 PST 2022
nridge added a comment.
Still haven't had a chance to take a super detailed look, but a few high-level thoughts:
1. The AST nodes that reference operator names should store source ranges associated with the operator names, such that we shouldn't need to do token-by-token manipulation. For example, `functionDecl->getNameInfo().getCXXOperatorNameRange()`.
2. I think I appreciate now the issue with `findExplicitReferences()`: it gives us `ReferenceLoc` objects, which store a single `SourceLocation` but do **not** retain the AST node containing the reference (thereby not allowing us to access the source range of the reference easily). We've run into this before (here <https://github.com/clangd/clangd/issues/839#issuecomment-899006073>), and contemplated modifying `ReferenceLoc` to retain the AST node containing the reference, but decided against it, so I guess we should stick to that. That said... would it make sense to handle the **single-token** cases with `findExplicitReferences()`? Or would that just end up splitting the logic / duplicating code more?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119077/new/
https://reviews.llvm.org/D119077
More information about the cfe-commits
mailing list