Skip to content

Commit

Permalink
[Format] Modernize SpaceBeforeParensCustom (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata committed Aug 27, 2023
1 parent 2a10510 commit ad183b9
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions clang/include/clang/Format/Format.h
Original file line number Diff line number Diff line change
Expand Up @@ -4021,43 +4021,43 @@ struct FormatStyle {
/// true: false:
/// if (...) {} vs. if(...) {}
/// \endcode
bool AfterControlStatements;
bool AfterControlStatements = false;
/// If ``true``, put space between foreach macros and opening parentheses.
/// \code
/// true: false:
/// FOREACH (...) vs. FOREACH(...)
/// <loop-body> <loop-body>
/// \endcode
bool AfterForeachMacros;
bool AfterForeachMacros = false;
/// If ``true``, put a space between function declaration name and opening
/// parentheses.
/// \code
/// true: false:
/// void f (); vs. void f();
/// \endcode
bool AfterFunctionDeclarationName;
bool AfterFunctionDeclarationName = false;
/// If ``true``, put a space between function definition name and opening
/// parentheses.
/// \code
/// true: false:
/// void f () {} vs. void f() {}
/// \endcode
bool AfterFunctionDefinitionName;
bool AfterFunctionDefinitionName = false;
/// If ``true``, put space between if macros and opening parentheses.
/// \code
/// true: false:
/// IF (...) vs. IF(...)
/// <conditional-body> <conditional-body>
/// \endcode
bool AfterIfMacros;
bool AfterIfMacros = false;
/// If ``true``, put a space between operator overloading and opening
/// parentheses.
/// \code
/// true: false:
/// void operator++ (int a); vs. void operator++(int a);
/// object.operator++ (10); object.operator++(10);
/// \endcode
bool AfterOverloadedOperator;
bool AfterOverloadedOperator = false;
/// If ``true``, put space between requires keyword in a requires clause and
/// opening parentheses, if there is one.
/// \code
Expand All @@ -4066,7 +4066,7 @@ struct FormatStyle {
/// requires (A<T> && B<T>) requires(A<T> && B<T>)
/// ... ...
/// \endcode
bool AfterRequiresInClause;
bool AfterRequiresInClause = false;
/// If ``true``, put space between requires keyword in a requires expression
/// and opening parentheses.
/// \code
Expand All @@ -4076,22 +4076,17 @@ struct FormatStyle {
/// ... ...
/// } }
/// \endcode
bool AfterRequiresInExpression;
bool AfterRequiresInExpression = false;
/// If ``true``, put a space before opening parentheses only if the
/// parentheses are not empty.
/// \code
/// true: false:
/// void f (int a); vs. void f();
/// f (a); f();
/// \endcode
bool BeforeNonEmptyParentheses;
bool BeforeNonEmptyParentheses = false;

SpaceBeforeParensCustom()
: AfterControlStatements(false), AfterForeachMacros(false),
AfterFunctionDeclarationName(false),
AfterFunctionDefinitionName(false), AfterIfMacros(false),
AfterOverloadedOperator(false), AfterRequiresInClause(false),
AfterRequiresInExpression(false), BeforeNonEmptyParentheses(false) {}
SpaceBeforeParensCustom() = default;

bool operator==(const SpaceBeforeParensCustom &Other) const {
return AfterControlStatements == Other.AfterControlStatements &&
Expand Down

3 comments on commit ad183b9

@sstwcw
Copy link
Contributor

@sstwcw sstwcw commented on ad183b9 Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@owenca @mydeveloperday Now the script to extract the format options
doesn't recognize it. I remember once doing something similar along
with changing the script. And they told me I should keep things the old
way. What about this time?

@sstwcw
Copy link
Contributor

@sstwcw sstwcw commented on ad183b9 Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rymiel @HazardyKnusperkeks Sorry I forgot about you.

@owenca
Copy link
Contributor

@owenca owenca commented on ad183b9 Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted in 4146b30.

Please sign in to comment.