diff options
author | Owen Pan <owenpiano@gmail.com> | 2018-09-28 09:17:00 +0000 |
---|---|---|
committer | Owen Pan <owenpiano@gmail.com> | 2018-09-28 09:17:00 +0000 |
commit | cb5ffbed714778667cdded482a447777cd22ae57 (patch) | |
tree | ecac136bf1dc6dc46c1d13e0a0367c247f541f3c /clang/unittests/Format/FormatTest.cpp | |
parent | 47a8980afada53e4ed206854ffc1073a485dd9c3 (diff) | |
download | bcm5719-llvm-cb5ffbed714778667cdded482a447777cd22ae57.tar.gz bcm5719-llvm-cb5ffbed714778667cdded482a447777cd22ae57.zip |
[ClangFormat] 'try' of function-try-block doesn't obey BraceWrapping
It should respond to AfterFunction, not AfterControlStatement.
Fixes PR39067
llvm-svn: 343305
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index dac8497c1e6..3e23c5e11b5 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -2628,6 +2628,16 @@ TEST_F(FormatTest, MacroCallsWithoutTrailingSemicolon) { " A(X x)\n" " try : t(0) {} catch (...) {}\n" "};")); + FormatStyle Style = getLLVMStyle(); + Style.BreakBeforeBraces = FormatStyle::BS_Custom; + Style.BraceWrapping.AfterControlStatement = true; + Style.BraceWrapping.AfterFunction = true; + EXPECT_EQ("void f()\n" + "try\n" + "{\n" + "}", + format("void f() try {\n" + "}", Style)); EXPECT_EQ("class SomeClass {\n" "public:\n" " SomeClass() EXCLUSIVE_LOCK_FUNCTION(mu_);\n" |