This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Add TypeNames option to disambiguate types/objects
ClosedPublic

Authored by owenpan on Jul 14 2023, 1:41 AM.

Details

Summary

If a non-keyword identifier is found in TypeNames, then a *, &, or && that follows it is annotated as TT_PointerOrReference.

Diff Detail

Event Timeline

owenpan created this revision.Jul 14 2023, 1:41 AM
Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptJul 14 2023, 1:41 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
owenpan requested review of this revision.Jul 14 2023, 1:41 AM
owenpan added inline comments.Jul 14 2023, 1:45 AM
clang/unittests/Format/TokenAnnotatorTest.cpp
284

This test case comes from D137327.

thieta added a subscriber: thieta.Jul 14 2023, 2:33 AM

Thanks for doing this!

This revision is now accepted and ready to land.Jul 15 2023, 8:05 AM
This revision was landed with ongoing or failed builds.Jul 18 2023, 2:20 PM
This revision was automatically updated to reflect the committed changes.

I used isSimpleTypeSpecifier() in the east/west const fixer, I think this could probably help there to catch more places too.. (you don't need to do that here)