From 4baa2a7fd0c866c7badaaf49c7faff59e0a49e3e Mon Sep 17 00:00:00 2001 From: Ben Hamilton Date: Thu, 8 Feb 2018 01:49:10 +0000 Subject: [PATCH] [clang-format] Set ObjCBinPackProtocolList to Never for google style Summary: This is split off from D42650, and sets ObjCBinPackProtocolList to Never for the google style. Depends On D42650 Test Plan: New tests added. make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: krasimir, jolesiak, stephanemoore Reviewed By: krasimir, jolesiak, stephanemoore Subscribers: klimek, cfe-commits, hokein, Wizard Differential Revision: https://reviews.llvm.org/D42708 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324553 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Format/Format.cpp | 1 + unittests/Format/FormatTestObjC.cpp | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 90b14e74f9..5fb775a0d3 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -710,6 +710,7 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) { GoogleStyle.IncludeIsMainRegex = "([-_](test|unittest))?$"; GoogleStyle.IndentCaseLabels = true; GoogleStyle.KeepEmptyLinesAtTheStartOfBlocks = false; + GoogleStyle.ObjCBinPackProtocolList = FormatStyle::BPS_Never; GoogleStyle.ObjCSpaceAfterProperty = false; GoogleStyle.ObjCSpaceBeforeProtocolList = true; GoogleStyle.PointerAlignment = FormatStyle::PAS_Left; diff --git a/unittests/Format/FormatTestObjC.cpp b/unittests/Format/FormatTestObjC.cpp index a99f486adf..d270aabea5 100644 --- a/unittests/Format/FormatTestObjC.cpp +++ b/unittests/Format/FormatTestObjC.cpp @@ -333,13 +333,16 @@ TEST_F(FormatTestObjC, FormatObjCInterface) { verifyFormat("@interface Foo (HackStuff) \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"); + // ObjCBinPackProtocolList should be BPS_Never by default. + verifyFormat("@interface fffffffffffff () <\n" + " fffffffffffff,\n" + " fffffffffffff,\n" + " fffffffffffff,\n" + " fffffffffffff> {\n" "}"); } -- 2.40.0