Page MenuHomePhabricator

[clangd] Use the "macro" semantic token for pre-defined identifiers
ClosedPublic

Authored by ckandeler on Aug 4 2022, 8:57 AM.

Diff Detail

Event Timeline

ckandeler created this revision.Aug 4 2022, 8:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2022, 8:57 AM
ckandeler requested review of this revision.Aug 4 2022, 8:57 AM
sammccall accepted this revision.Aug 18 2022, 2:31 AM

Yeah, this seems reasonable to me.
Wonder if we can support this in hover too!

This revision is now accepted and ready to land.Aug 18 2022, 2:31 AM
sammccall added inline comments.Aug 18 2022, 4:21 AM
clang-tools-extra/clangd/SemanticHighlighting.cpp
546

actually, would HighlightingKind::LocalVariable be more appropriate?

The standard calls this a "The function-local predefined variable".

Admittedly I have a tendency to think of it as macro-like by analogy with __LINE__ etc but this model is observably wrong: it breaks down with templates and in other ways.

ckandeler added inline comments.Aug 18 2022, 5:54 AM
clang-tools-extra/clangd/SemanticHighlighting.cpp
546

Hm, yes, I was not aware it was specified explicitly as a local variable. Will change.

ckandeler updated this revision to Diff 453648.Aug 18 2022, 6:45 AM

Use variable instead of macro.

(thanks, still LG)

ckandeler marked an inline comment as not done.Aug 18 2022, 7:10 AM

Thanks for the review. Can you please merge it?

Sure thing!

Also sent D132135 to support hover.

By the way: How do I change the commit message when using arc? It seems to ignore all subsequent changes other than in the code itself, and now the patch is in the repo with a misleading commit message.

By the way: How do I change the commit message when using arc? It seems to ignore all subsequent changes other than in the code itself, and now the patch is in the repo with a misleading commit message.

Yeah that's unfortunate and I do it myself all the time :-(

When I remember, my workflow is to amend the commit message locally with git, and then arc diff --verbatim will push this into the phab description (in addition to the usual snapshotting behavior).
But often I forget and edit it in phab, and I don't know of a command to pull those edits down into my git repo.

But often I forget and edit it in phab, and I don't know of a command to pull those edits down into my git repo.

I ended up always doing this for landing changes:

$ git switch main
$ git pull --ff-only
$ arc patch --nobranch D123456
$ git push origin main

That way I get the latest description from phabricator and also the reviewed-by tags.
And I basically ignore what the commit messages says on my branch while it's WIP, phab is source of truth after the initial change.