[PATCH] D148284: [clangd] Add "readonly" token to const member expressions

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 25 00:46:36 PDT 2023


nridge added a comment.

Thanks for the patch!

`addExtraModifier` is a kind of hacky mechanism to attach modifiers in `CollectExtraHighlightings` to tokens created during `findExplicitReferences()`; it would be nicer to add the modifier at the time of creating the token, but it doesn't look like we have enough information in `ReferenceLoc` to do that in this case. We could consider extending `ReferenceLoc` with more information in the future, but I think this is fine for now.

Do you think it's feasible to make a best-effort attempt to use similar logic for `CXXDependentScopeMemberExpr`? I don't think it returns a useful `getType()`, but its `getBaseType()` should tell us whether the object type is const or not. (It wouldn't handle `mutable` because we don't have a concrete member decl to work with, but that's a less common case compared to the base type being const or not.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148284



More information about the cfe-commits mailing list