diff options
author | Daniel Jasper <djasper@google.com> | 2015-05-12 10:16:02 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-05-12 10:16:02 +0000 |
commit | 5fc133e71e62090d72a631aa576ac85100a26772 (patch) | |
tree | efeb8ad196b6f1578797d6ea93df75d162fc178e /clang/unittests/Format/FormatTest.cpp | |
parent | 6f30dc18d3bc25de7c3891de8de6fb764f04c2e5 (diff) | |
download | bcm5719-llvm-5fc133e71e62090d72a631aa576ac85100a26772.tar.gz bcm5719-llvm-5fc133e71e62090d72a631aa576ac85100a26772.zip |
clang-format: Fix hanging nested blocks in macros.
Before:
#define MACRO() \
Debug(aaa, /* force line break */ \
{ \
int i; \
int j; \
})
After:
#define MACRO() \
Debug(aaa, /* force line break */ \
{ \
int i; \
int j; \
})
llvm-svn: 237108
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 22217c06f4c..e6dee38fb08 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -3284,6 +3284,18 @@ TEST_F(FormatTest, LayoutNestedBlocks) { verifyNoCrash("^{v^{a}}"); } +TEST_F(FormatTest, FormatNestedBlocksInMacros) { + EXPECT_EQ("#define MACRO() \\\n" + " Debug(aaa, /* force line break */ \\\n" + " { \\\n" + " int i; \\\n" + " int j; \\\n" + " })", + format("#define MACRO() Debug(aaa, /* force line break */ \\\n" + " { int i; int j; })", + getGoogleStyle())); +} + TEST_F(FormatTest, IndividualStatementsOfNestedBlocks) { EXPECT_EQ("DEBUG({\n" " int i;\n" |