diff options
author | Daniel Jasper <djasper@google.com> | 2015-04-30 09:24:17 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-04-30 09:24:17 +0000 |
commit | e9f5357f495dabedcc84bd956da7c357d8547fd1 (patch) | |
tree | a55f776bb37a175175862e7c352159499eb5662e /clang/unittests/Format/FormatTest.cpp | |
parent | 90b059d555e7e3a910dad247a342babb537d5cd7 (diff) | |
download | bcm5719-llvm-e9f5357f495dabedcc84bd956da7c357d8547fd1.tar.gz bcm5719-llvm-e9f5357f495dabedcc84bd956da7c357d8547fd1.zip |
clang-format: Don't merge short else blocks.
Before (with the appropriate flags settings):
if (a) {
f();
} else { g(); }
Before (with other appropriate flags settings):
if (a) { f(); } else {
g();
}
After:
if (a) {
f();
} else {
g();
}
llvm-svn: 236217
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 9f340042c43..e2db4d10b95 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -416,6 +416,12 @@ TEST_F(FormatTest, FormatShortBracedStatements) { " f();\n" "}", AllowSimpleBracedStatements); + verifyFormat("if (true) {\n" + " f();\n" + "} else {\n" + " f();\n" + "}", + AllowSimpleBracedStatements); verifyFormat("template <int> struct A2 {\n" " struct B {};\n" @@ -427,6 +433,12 @@ TEST_F(FormatTest, FormatShortBracedStatements) { " f();\n" "}", AllowSimpleBracedStatements); + verifyFormat("if (true) {\n" + " f();\n" + "} else {\n" + " f();\n" + "}", + AllowSimpleBracedStatements); AllowSimpleBracedStatements.AllowShortLoopsOnASingleLine = false; verifyFormat("while (true) {\n" |