This is an archive of the discontinued LLVM Phabricator instance.

[clang][tooling] Fix `name` range-selector to handle TypeLocs correctly.
ClosedPublic

Authored by ymandel on Aug 24 2023, 1:23 PM.

Details

Summary

Previously, where name was applied to a template-specialization TypeLoc, it
returned the entire specialization (name, brackets, args) rather than just the
name identifier. With this change, exactly the name token is selected.

Diff Detail

Event Timeline

ymandel created this revision.Aug 24 2023, 1:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2023, 1:23 PM
ymandel requested review of this revision.Aug 24 2023, 1:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2023, 1:23 PM
li.zhe.hua accepted this revision.Aug 24 2023, 1:45 PM
li.zhe.hua added inline comments.
clang/lib/Tooling/Transformer/RangeSelector.cpp
239–240

Optional: If the token range is only one token, you can specify a single location that is the start of the token.

clang/unittests/Tooling/RangeSelectorTest.cpp
493

Nit: Is the data member necessary?

This revision is now accepted and ready to land.Aug 24 2023, 1:45 PM
ymandel updated this revision to Diff 553455.Aug 25 2023, 6:40 AM
ymandel marked 2 inline comments as done.

address comments

ymandel updated this revision to Diff 553456.Aug 25 2023, 6:41 AM

clang-format

This revision was landed with ongoing or failed builds.Aug 25 2023, 7:45 AM
This revision was automatically updated to reflect the committed changes.