[PATCH] D28462: clang-format: Add new style option AlignConsecutiveMacros

Micah S. via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 27 13:36:31 PST 2019


micah-s added a comment.

In D28462#1412556 <https://reviews.llvm.org/D28462#1412556>, @MyDeveloperDay wrote:

> For those wishing to test the effectiveness of unlanded revisions like this and to reduce the amount of time between Windows snapshot builds (https://llvm.org/builds/), I have forked llvm-project and using AppVeyor  to build a new x64 Windows clang-format-experimental.exe binary, on a semi-automatic basis. (master branch clang-format with selected unlanded revisions)
>
> https://github.com/mydeveloperday/clang-experimental/releases


Thanks @MyDeveloperDay! That is very helpful, and significantly reduced the overhead for testing.

I removed the `// clang-format off`/`on` markers around all of our aligned macros, applied the `AlignConsecurityMacros: true` setting to our .clang-format, and reformatted the affected files using the clang-format-experimental.exe binary.  My own experience was flawless.  The only issue we'll have to work around is that we have some longer macro sets that include unused values in a series.

For example:

  ...
  #define CL_SCAN_ALGORITHMIC       0x200
  //#define UNUSED                  0x400
  #define CL_SCAN_PHISHING_BLOCKSSL 0x800
  ...

becomes

  ...
  #define CL_SCAN_ALGORITHMIC 0x200
  //#define UNUSED                  0x400
  #define CL_SCAN_PHISHING_BLOCKSSL 0x800
  ...

I can't really complain though, because it's working as intended -- we'll just have to find a different way to indicate reserved/unused values in a series.  I'll probably just do something like `CL_SCAN_UNUSED_0`/`1`/`2`/etc.
Big thumbs up here from an end user experience.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D28462/new/

https://reviews.llvm.org/D28462





More information about the cfe-commits mailing list