This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Don't modify template arguments on the LHS of assignment
ClosedPublic

Authored by rymiel on Apr 11 2023, 9:28 AM.

Details

Summary

After clang-format has determined that an equals sign starts an
expression, it will also go backwards and modify any star/amp/ampamp
binary operators on the left side of the assignment to be
pointers/references instead.

There already exists logic to skip over contents of parentheses and
square brackets, but this patch also expands that logic to apply to
angle brackets. This is so that binary operators inside of template
arguments would not be touched, primary arguments to non-type template
parameters.

Fixes https://github.com/llvm/llvm-project/issues/62055

Diff Detail

Event Timeline

rymiel created this revision.Apr 11 2023, 9:28 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 11 2023, 9:28 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
rymiel requested review of this revision.Apr 11 2023, 9:28 AM
This revision is now accepted and ready to land.Apr 11 2023, 12:22 PM
owenpan accepted this revision.Apr 11 2023, 1:18 PM
MyDeveloperDay accepted this revision.Apr 11 2023, 2:06 PM
This revision was landed with ongoing or failed builds.Apr 11 2023, 2:36 PM
This revision was automatically updated to reflect the committed changes.