summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestObjC.cpp
diff options
context:
space:
mode:
authorFrancois Ferrand <thetypz@gmail.com>2018-02-27 13:48:27 +0000
committerFrancois Ferrand <thetypz@gmail.com>2018-02-27 13:48:27 +0000
commita2484b251bb821561b626d55702c435b33267df1 (patch)
treeaeba629e3ed1bf364d9110e84b0e419b07d0a581 /clang/unittests/Format/FormatTestObjC.cpp
parentba91c3de383cbcc1f5cdb678412a622118096a78 (diff)
downloadbcm5719-llvm-a2484b251bb821561b626d55702c435b33267df1.tar.gz
bcm5719-llvm-a2484b251bb821561b626d55702c435b33267df1.zip
clang-format: use AfterControlStatement to format ObjC control blocks
ObjC defines `@autoreleasepool` and `@synchronized` control blocks. These used to be formatted according to the `AfterObjCDeclaration` brace- wrapping flag, which is not very consistent. This patch changes the behavior to use the `AfterControlStatement` flag instead. This should not affect the behavior unless a custom brace wrapping mode is used. Reviewers: krasimir, djasper, klimek, benhamilton Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D43232 llvm-svn: 326192
Diffstat (limited to 'clang/unittests/Format/FormatTestObjC.cpp')
-rw-r--r--clang/unittests/Format/FormatTestObjC.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/unittests/Format/FormatTestObjC.cpp b/clang/unittests/Format/FormatTestObjC.cpp
index d592b39a482..15c3d7622cf 100644
--- a/clang/unittests/Format/FormatTestObjC.cpp
+++ b/clang/unittests/Format/FormatTestObjC.cpp
@@ -187,7 +187,8 @@ TEST_F(FormatTestObjC, FormatObjCAutoreleasepool) {
"@autoreleasepool {\n"
" f();\n"
"}\n");
- Style.BreakBeforeBraces = FormatStyle::BS_Allman;
+ Style.BreakBeforeBraces = FormatStyle::BS_Custom;
+ Style.BraceWrapping.AfterControlStatement = true;
verifyFormat("@autoreleasepool\n"
"{\n"
" f();\n"
@@ -216,7 +217,8 @@ TEST_F(FormatTestObjC, FormatObjCSynchronized) {
"@synchronized(self) {\n"
" f();\n"
"}\n");
- Style.BreakBeforeBraces = FormatStyle::BS_Allman;
+ Style.BreakBeforeBraces = FormatStyle::BS_Custom;
+ Style.BraceWrapping.AfterControlStatement = true;
verifyFormat("@synchronized(self)\n"
"{\n"
" f();\n"
OpenPOWER on IntegriCloud