benhamilton created this revision. benhamilton added reviewers: krasimir, jolesiak, stephanemoore.
This is split off from https://reviews.llvm.org/D42650, and sets BinPackObjCProtocolList to Never for the google style. Depends On https://reviews.llvm.org/D42650 Test Plan: New tests added. make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests Repository: rC Clang https://reviews.llvm.org/D42708 Files: lib/Format/Format.cpp unittests/Format/FormatTestObjC.cpp Index: unittests/Format/FormatTestObjC.cpp =================================================================== --- unittests/Format/FormatTestObjC.cpp +++ unittests/Format/FormatTestObjC.cpp @@ -322,13 +322,16 @@ verifyFormat("@interface Foo (HackStuff) <MyProtocol>\n" "+ (id)init;\n" "@end"); - Style.BinPackParameters = false; - Style.ColumnLimit = 80; - verifyFormat("@interface aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa () <\n" - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n" - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n" - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n" - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa> {\n" + Style.ColumnLimit = 40; + // BinPackParameters should be true by default. + verifyFormat("void eeeeeeee(int eeeee, int eeeee,\n" + " int eeeee, int eeeee);\n"); + // BinPackObjCProtocolList should be BPS_Never by default. + verifyFormat("@interface fffffffffffff () <\n" + " fffffffffffff,\n" + " fffffffffffff,\n" + " fffffffffffff,\n" + " fffffffffffff> {\n" "}"); } Index: lib/Format/Format.cpp =================================================================== --- lib/Format/Format.cpp +++ lib/Format/Format.cpp @@ -762,6 +762,7 @@ GoogleStyle.SpacesInContainerLiterals = false; } else if (Language == FormatStyle::LK_ObjC) { GoogleStyle.ColumnLimit = 100; + GoogleStyle.BinPackObjCProtocolList = FormatStyle::BPS_Never; } return GoogleStyle;
Index: unittests/Format/FormatTestObjC.cpp =================================================================== --- unittests/Format/FormatTestObjC.cpp +++ unittests/Format/FormatTestObjC.cpp @@ -322,13 +322,16 @@ verifyFormat("@interface Foo (HackStuff) <MyProtocol>\n" "+ (id)init;\n" "@end"); - Style.BinPackParameters = false; - Style.ColumnLimit = 80; - verifyFormat("@interface aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa () <\n" - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n" - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n" - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n" - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa> {\n" + Style.ColumnLimit = 40; + // BinPackParameters should be true by default. + verifyFormat("void eeeeeeee(int eeeee, int eeeee,\n" + " int eeeee, int eeeee);\n"); + // BinPackObjCProtocolList should be BPS_Never by default. + verifyFormat("@interface fffffffffffff () <\n" + " fffffffffffff,\n" + " fffffffffffff,\n" + " fffffffffffff,\n" + " fffffffffffff> {\n" "}"); } Index: lib/Format/Format.cpp =================================================================== --- lib/Format/Format.cpp +++ lib/Format/Format.cpp @@ -762,6 +762,7 @@ GoogleStyle.SpacesInContainerLiterals = false; } else if (Language == FormatStyle::LK_ObjC) { GoogleStyle.ColumnLimit = 100; + GoogleStyle.BinPackObjCProtocolList = FormatStyle::BPS_Never; } return GoogleStyle;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits