clang-format: adding new style option for C/C++ macro alignment


clang newbie here, playing with clang-format, learning by adding a new style
option which I've wanted for a while:

(hopefully the addition to docs/ClangFormatStyleOptions.rst is sufficient to
explain my intentions)

Now, the discussion about whether or not this option is something needed by
clang-format, is a discussion I'd like to save for later. Right now I'm just
figuring things out :slight_smile:

I looked at existing alignConsecutive* functions in
lib/Format/WhitespaceManager.cpp, and sort of guessed my way into a new
alignConsecutiveMacros function. It works, probably by accident, with simple
test files, but I'm making several assumptions. I'm hoping somebody here can
point me in the right direction to resolve these assumptions!

alignConsecutiveMacros(): Right now, I am calling AlignTokens to align on
"any numerical constant that occurs 3 Changes after a tok::hash". I see two
issues with this:

    1. I am not sure if 1 Change == 1 Token; can there be multiple changes to
       a Token?

    2. Instead of tok::hash, I want to specifically check for tok::pp_define,
       however this is different token type (PPKeywordKind) which is not
       tracked by a Change. So I'm not sure how to (or if I can) access PP
       tokens here.

To summarise, instead of aligning on "any numerical constant 3 Changes
after a tok::hash", like the linked code above is doing, I want to align on
"the 4th token in a #define directive".

So, does anyone have any pointers on how I might put into code "the 4th token in
a #define directive"?

Happy New Year,