From 908fd09a13b2e89a52282478544f7f70cf0a887f Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 31 Jan 2024 20:20:26 -0800 Subject: [clang-format] Simplify the AfterPlacementOperator option (#79796) Change AfterPlacementOperator to a boolean and deprecate SBPO_Never, which meant never inserting a space except when after new/delete. Fixes #78892. --- clang/unittests/Format/ConfigParseTest.cpp | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'clang/unittests/Format/ConfigParseTest.cpp') diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp index 2a8d793..6436581 100644 --- a/clang/unittests/Format/ConfigParseTest.cpp +++ b/clang/unittests/Format/ConfigParseTest.cpp @@ -231,6 +231,7 @@ TEST(ConfigParseTest, ParsesConfigurationBools) { AfterFunctionDefinitionName); CHECK_PARSE_NESTED_BOOL(SpaceBeforeParensOptions, AfterIfMacros); CHECK_PARSE_NESTED_BOOL(SpaceBeforeParensOptions, AfterOverloadedOperator); + CHECK_PARSE_NESTED_BOOL(SpaceBeforeParensOptions, AfterPlacementOperator); CHECK_PARSE_NESTED_BOOL(SpaceBeforeParensOptions, BeforeNonEmptyParentheses); CHECK_PARSE_NESTED_BOOL(SpacesInParensOptions, InCStyleCasts); CHECK_PARSE_NESTED_BOOL(SpacesInParensOptions, InConditionalStatements); @@ -609,24 +610,6 @@ TEST(ConfigParseTest, ParsesConfiguration) { SpaceBeforeParens, FormatStyle::SBPO_ControlStatementsExceptControlMacros); - Style.SpaceBeforeParens = FormatStyle::SBPO_Custom; - Style.SpaceBeforeParensOptions.AfterPlacementOperator = - FormatStyle::SpaceBeforeParensCustom::APO_Always; - CHECK_PARSE("SpaceBeforeParensOptions:\n" - " AfterPlacementOperator: Never", - SpaceBeforeParensOptions.AfterPlacementOperator, - FormatStyle::SpaceBeforeParensCustom::APO_Never); - - CHECK_PARSE("SpaceBeforeParensOptions:\n" - " AfterPlacementOperator: Always", - SpaceBeforeParensOptions.AfterPlacementOperator, - FormatStyle::SpaceBeforeParensCustom::APO_Always); - - CHECK_PARSE("SpaceBeforeParensOptions:\n" - " AfterPlacementOperator: Leave", - SpaceBeforeParensOptions.AfterPlacementOperator, - FormatStyle::SpaceBeforeParensCustom::APO_Leave); - // For backward compatibility: Style.SpacesInParens = FormatStyle::SIPO_Never; Style.SpacesInParensOptions = {}; -- cgit v1.1