[PATCH] D108320: Add semantic token modifier for non-const reference parameter
Tom Praschan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 19 11:31:03 PDT 2021
tom-anders planned changes to this revision.
tom-anders added inline comments.
================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:547
+ if (isa<DeclRefExpr>(Arg)) {
+ Location = Arg->getBeginLoc();
+ } else if (auto *M = dyn_cast<MemberExpr>(Arg)) {
----------------
sammccall wrote:
> nridge wrote:
> > For a qualified name (e.g. `A::B`), I think this is going to return the beginning of the qualifier, whereas we only want to highlight the last name (otherwise there won't be a matching token from the first pass).
> >
> > So I think we want `getLocation()` instead.
> >
> > (Also makes a good test case.)
> And getLocation() will do the right thing for DeclRefExpr, MemberExpr, and others, so this can just be `isa<DeclRefExpr, MemberExpr>` with no need for dyn_cast.
I'm not sure which getLocation() you're talking about here. There's DeclRefExpr::getLocation(), but neither Expr::getLocation() nor MemberExpr::getLocation(). Am I missing something?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108320/new/
https://reviews.llvm.org/D108320
More information about the cfe-commits
mailing list