This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Fix east const pointer alignment of operators
ClosedPublic

Authored by nrieck on Mar 27 2021, 10:30 AM.

Details

Summary

This patch fixes left pointer alignment after pointer qualifiers of
operators. Currently "operator void const*()" is formatted with a space between
const and pointer despite setting PointerAlignment to Left.

AFAICS this has been broken since clang-format 10.

Diff Detail

Event Timeline

nrieck requested review of this revision.Mar 27 2021, 10:30 AM
nrieck created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMar 27 2021, 10:30 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Eugene.Zelenko added a project: Restricted Project.
curdeius accepted this revision.Mar 27 2021, 2:28 PM
curdeius added a subscriber: curdeius.

LGTM. But please wait for @MyDeveloperDay's review too.

This revision is now accepted and ready to land.Mar 27 2021, 2:28 PM
curdeius added inline comments.Mar 27 2021, 2:37 PM
clang/lib/Format/TokenAnnotator.cpp
2958

Nit: you might add operator void const/volatile*() to the list.

MyDeveloperDay accepted this revision.Mar 29 2021, 12:33 AM

This LGTM, thank you.

Thinking out loud, do we test volatile at all?

Ah, I missed transferring my commit access from svn. If anyone could commit for me, please do.

Thinking out loud, do we test volatile at all?

I see only the variants with block comments inbetween. There should probably more, but it's a lot of permutations though.

This revision was automatically updated to reflect the committed changes.