This is an archive of the discontinued LLVM Phabricator instance.

Add field designated initializers logic in Tooling/Rename
ClosedPublic

Authored by dcastagna on Apr 12 2021, 8:36 AM.

Details

Summary

clang Tooling, and more specifically Refactoring/Rename, have support
code to extract source locations given a Unified Symbol Resolution set.
This support code is used by clang-rename and other tools that might not
be in the tree.

Currently field designated initializer are not supported.
So, renaming S::a to S::b in this code:

S s = { .a = 10 };

will not extract the field designated initializer for a (the 'a' after the
dot).

This CL adds support for field designated initialized to RecursiveSymbolVisitor
and RenameLocFinder that is used in createRenameAtomicChanges.

Diff Detail

Event Timeline

dcastagna created this revision.Apr 12 2021, 8:36 AM
dcastagna requested review of this revision.Apr 12 2021, 8:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 12 2021, 8:36 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
jlebar accepted this revision.Apr 12 2021, 8:48 AM

I can't argue with this.

This revision is now accepted and ready to land.Apr 12 2021, 8:48 AM
dcastagna updated this revision to Diff 336878.Apr 12 2021, 9:58 AM

Fixed clang-format pre-merge lints

Actually run git clang-format

clang-format again

I guess you need me or Michael to push this. Happy to do so once you're
happy with it.

Thank you Justin.
I'm happy with this now that I finally managed to get rid of the lint errors.
Let's wait for Micheal's opinion or until tomorrow and then we can push it?

I defer to Justin, he knows AST much better than I do.

This revision was automatically updated to reflect the committed changes.