clang-format: Add MacroBlock{Begin,End} options
The MacroBlockBegin and MacroBlockEnd options make matching macro identifiers behave like '{' and '}', respectively, in terms of indentation. Mozilla code, for example, uses several macros that begin and end a scope. Previously, Clang-Format removed the indentation resulting in: MACRO_BEGIN(...) MACRO_ENTRY(...) MACRO_ENTRY(...) MACRO_END Now, using the options MacroBlockBegin: "^[A-Z_]+_BEGIN$" MacroBlockEnd: "^[A-Z_]+_END$" will yield the expected result: MACRO_BEGIN(...) MACRO_ENTRY(...) MACRO_ENTRY(...) MACRO_END Differential Revision: http://reviews.llvm.org/D10840 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241363 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- docs/ClangFormatStyleOptions.rst 6 additions, 0 deletionsdocs/ClangFormatStyleOptions.rst
- include/clang/Format/Format.h 8 additions, 0 deletionsinclude/clang/Format/Format.h
- lib/Format/Format.cpp 26 additions, 7 deletionslib/Format/Format.cpp
- lib/Format/FormatToken.h 2 additions, 0 deletionslib/Format/FormatToken.h
- lib/Format/UnwrappedLineParser.cpp 31 additions, 3 deletionslib/Format/UnwrappedLineParser.cpp
- unittests/Format/FormatTest.cpp 18 additions, 0 deletionsunittests/Format/FormatTest.cpp
Loading
Please register or sign in to comment