diff options
author | Daniel Jasper <djasper@google.com> | 2016-12-13 10:05:03 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2016-12-13 10:05:03 +0000 |
commit | e4ada024b0442639907f2005dc4b735b05d225bc (patch) | |
tree | f8d2f1eaf7e07bad2e742933463d172e91b4d664 /clang/unittests/Format | |
parent | e7be4a004b8a0c26841e3726f201e132187db1fe (diff) | |
download | bcm5719-llvm-e4ada024b0442639907f2005dc4b735b05d225bc.tar.gz bcm5719-llvm-e4ada024b0442639907f2005dc4b735b05d225bc.zip |
clang-format: Improve braced-list detection.
Before:
vector<int> v { 12 }
GUARDED_BY(mutex);
After:
vector<int> v{12} GUARDED_BY(mutex);
llvm-svn: 289525
Diffstat (limited to 'clang/unittests/Format')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index fe2d4704207..5bed7a81de1 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -6504,6 +6504,19 @@ TEST_F(FormatTest, LayoutCxx11BraceInitializers) { "};"); verifyFormat("#define A {a, a},"); + // Cases where distinguising braced lists and blocks is hard. + verifyFormat("vector<int> v{12} GUARDED_BY(mutex);"); + verifyFormat("void f() {\n" + " return; // comment\n" + "}\n" + "SomeType t;"); + verifyFormat("void f() {\n" + " if (a) {\n" + " f();\n" + " }\n" + "}\n" + "SomeType t;"); + // In combination with BinPackArguments = false. FormatStyle NoBinPacking = getLLVMStyle(); NoBinPacking.BinPackArguments = false; |