Fix test diff on Phabricator.
http://reviews.llvm.org/D10372
Files:
lib/Format/UnwrappedLineParser.cpp
unittests/Format/FormatTest.cpp
Index: lib/Format/UnwrappedLineParser.cpp
===================================================================
--- lib/Format/UnwrappedLineParser.cpp
+++ lib/Format/UnwrappedLineParser.cpp
@@ -657,6 +657,16 @@
nextToken();
addUnwrappedLine();
return;
+ case tok::objc_autoreleasepool:
+ nextToken();
+ if (FormatTok->Tok.is(tok::l_brace)) {
+ if (Style.BreakBeforeBraces == FormatStyle::BS_Allman ||
+ Style.BreakBeforeBraces == FormatStyle::BS_GNU)
+ addUnwrappedLine();
+ parseBlock(/*MustBeDeclaration=*/false);
+ }
+ addUnwrappedLine();
+ return;
case tok::objc_synchronized:
nextToken();
if (FormatTok->Tok.is(tok::l_paren))
Index: unittests/Format/FormatTest.cpp
===================================================================
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -2497,6 +2497,27 @@
"});\n");
}
+TEST_F(FormatTest, FormatObjCAutoreleasepool) {
+ FormatStyle Style = getLLVMStyle();
+ verifyFormat("@autoreleasepool {\n"
+ " f();\n"
+ "}\n"
+ "@autoreleasepool {\n"
+ " f();\n"
+ "}\n",
+ Style);
+ Style.BreakBeforeBraces = FormatStyle::BS_Allman;
+ verifyFormat("@autoreleasepool\n"
+ "{\n"
+ " f();\n"
+ "}\n"
+ "@autoreleasepool\n"
+ "{\n"
+ " f();\n"
+ "}\n",
+ Style);
+}
+
TEST_F(FormatTest, FormatObjCSynchronized) {
FormatStyle Style = getLLVMStyleWithColumns(32);
EXPECT_FALSE(Style.ObjCSpaceAfterSynchronized);
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lib/Format/UnwrappedLineParser.cpp
===================================================================
--- lib/Format/UnwrappedLineParser.cpp
+++ lib/Format/UnwrappedLineParser.cpp
@@ -657,6 +657,16 @@
nextToken();
addUnwrappedLine();
return;
+ case tok::objc_autoreleasepool:
+ nextToken();
+ if (FormatTok->Tok.is(tok::l_brace)) {
+ if (Style.BreakBeforeBraces == FormatStyle::BS_Allman ||
+ Style.BreakBeforeBraces == FormatStyle::BS_GNU)
+ addUnwrappedLine();
+ parseBlock(/*MustBeDeclaration=*/false);
+ }
+ addUnwrappedLine();
+ return;
case tok::objc_synchronized:
nextToken();
if (FormatTok->Tok.is(tok::l_paren))
Index: unittests/Format/FormatTest.cpp
===================================================================
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -2497,6 +2497,27 @@
"});\n");
}
+TEST_F(FormatTest, FormatObjCAutoreleasepool) {
+ FormatStyle Style = getLLVMStyle();
+ verifyFormat("@autoreleasepool {\n"
+ " f();\n"
+ "}\n"
+ "@autoreleasepool {\n"
+ " f();\n"
+ "}\n",
+ Style);
+ Style.BreakBeforeBraces = FormatStyle::BS_Allman;
+ verifyFormat("@autoreleasepool\n"
+ "{\n"
+ " f();\n"
+ "}\n"
+ "@autoreleasepool\n"
+ "{\n"
+ " f();\n"
+ "}\n",
+ Style);
+}
+
TEST_F(FormatTest, FormatObjCSynchronized) {
FormatStyle Style = getLLVMStyleWithColumns(32);
EXPECT_FALSE(Style.ObjCSpaceAfterSynchronized);
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits