]> granicus.if.org Git - clang/commit
clang-format: Add MacroBlock{Begin,End} options
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Fri, 3 Jul 2015 17:25:16 +0000 (17:25 +0000)
committerBirunthan Mohanathas <birunthan@mohanathas.com>
Fri, 3 Jul 2015 17:25:16 +0000 (17:25 +0000)
commit0af047c817acbc67e61aa82f0b43a54d61b753f8
tree04eebd0d9d9357e43e413b23b5597d331073a26e
parent3d26c174503eb13c691dd487b14f217406bf1d64
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
docs/ClangFormatStyleOptions.rst
include/clang/Format/Format.h
lib/Format/Format.cpp
lib/Format/FormatToken.h
lib/Format/UnwrappedLineParser.cpp
unittests/Format/FormatTest.cpp