]> granicus.if.org Git - clang/commit
clang-format: Add new style option AlignConsecutiveMacros
authorSam McCall <sam.mccall@gmail.com>
Tue, 2 Jul 2019 15:53:14 +0000 (15:53 +0000)
committerSam McCall <sam.mccall@gmail.com>
Tue, 2 Jul 2019 15:53:14 +0000 (15:53 +0000)
commit54b8029400637989d16f8467643c46296e62e1d3
tree18d71b51ad8c9051a0b070733b6e168d4c38a831
parentc1bb4b1c1b13d755c44d322e0a544c639d095d29
clang-format: Add new style option AlignConsecutiveMacros

This option behaves similarly to AlignConsecutiveDeclarations and
AlignConsecutiveAssignments, aligning the assignment of C/C++
preprocessor macros on consecutive lines.

I've worked in many projects (embedded, mostly) where header files full
of large, well-aligned "#define" blocks are a common pattern. We
normally avoid using clang-format on these files, since it ruins any
existing alignment in said blocks. This style option will align "simple"
PP macros (no parameters) and PP macros with parameter lists on
consecutive lines.

Related Bugzilla entry (thanks mcuddie):
https://llvm.org/bugs/show_bug.cgi?id=20637

Patch by Nick Renieris (VelocityRa)!

Differential Revision: https://reviews.llvm.org/D28462

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364938 91177308-0d34-0410-b5e6-96231b3b80d8
docs/ClangFormatStyleOptions.rst
include/clang/Format/Format.h
lib/Format/Format.cpp
lib/Format/WhitespaceManager.cpp
lib/Format/WhitespaceManager.h
unittests/Format/FormatTest.cpp