diff options
author | Daniel Jasper <djasper@google.com> | 2016-04-06 15:02:46 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2016-04-06 15:02:46 +0000 |
commit | 406094728964cfdef630d25f6034c25175841870 (patch) | |
tree | f23c98b7f637de2e4b08fb56b91e5981066ded28 /clang/unittests/Format/FormatTest.cpp | |
parent | 0dbd37543c5f5a77c253c87cb82bb995e56302cf (diff) | |
download | bcm5719-llvm-406094728964cfdef630d25f6034c25175841870.tar.gz bcm5719-llvm-406094728964cfdef630d25f6034c25175841870.zip |
clang-format: Support labels in brace-less ifs.
While I am not personally convinced about the usefulness of this
construct, we should break it.
Before:
if (a) label:
f();
After:
if (a)
label:
f();
llvm-svn: 265545
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 723e05f224d..55fd5fba4aa 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -301,6 +301,12 @@ TEST_F(FormatTest, FormatIfWithoutCompoundStatement) { " // comment\n" " f();", AllowsMergedIf); + verifyFormat("{\n" + " if (a)\n" + " label:\n" + " f();\n" + "}", + AllowsMergedIf); verifyFormat("if (a)\n" " ;", AllowsMergedIf); |