Skip to content

Commit 8cde2ae

Browse files
committed
Remove InAttributeSpecifiers
1 parent 9116b43 commit 8cde2ae

File tree

5 files changed

+9
-25
lines changed

5 files changed

+9
-25
lines changed

clang/include/clang/Format/Format.h

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4661,16 +4661,6 @@ struct FormatStyle {
46614661
/// false:
46624662
/// Uses the applicable option.
46634663
bool ExceptDoubleParentheses;
4664-
/// Put a space in parentheses of attribute specifiers.
4665-
/// \code
4666-
/// true:
4667-
/// __attribute__( ( noreturn ) )
4668-
/// \endcode
4669-
/// \code
4670-
/// false:
4671-
/// _attribute__((noreturn))
4672-
/// \endcode
4673-
bool InAttributeSpecifiers;
46744664
/// Put a space in parentheses only inside conditional statements
46754665
/// (``for/if/while/switch...``).
46764666
/// \code
@@ -4704,27 +4694,25 @@ struct FormatStyle {
47044694
/// decltype( ( x ) ) decltype((x))
47054695
/// x = ( (int32)y ) x = ((int32))y
47064696
/// y = ( (int ( * )( int ))foo )( x ); y = ((int (*)(int))foo)(x);
4697+
/// __attribute__( ( noreturn ) ) __attribute__((noreturn))
47074698
/// \endcode
47084699
bool Other;
47094700

47104701
SpacesInParensCustom()
4711-
: ExceptDoubleParentheses(false), InAttributeSpecifiers(false),
4712-
InConditionalStatements(false), InCStyleCasts(false),
4713-
InEmptyParentheses(false), Other(false) {}
4702+
: ExceptDoubleParentheses(false),
4703+
InConditionalStatements(false), InCStyleCasts(false),
4704+
InEmptyParentheses(false), Other(false) {}
47144705

47154706
SpacesInParensCustom(bool ExceptDoubleParentheses,
4716-
bool InAttributeSpecifiers,
47174707
bool InConditionalStatements, bool InCStyleCasts,
47184708
bool InEmptyParentheses, bool Other)
47194709
: ExceptDoubleParentheses(ExceptDoubleParentheses),
4720-
InAttributeSpecifiers(InAttributeSpecifiers),
47214710
InConditionalStatements(InConditionalStatements),
47224711
InCStyleCasts(InCStyleCasts), InEmptyParentheses(InEmptyParentheses),
47234712
Other(Other) {}
47244713

47254714
bool operator==(const SpacesInParensCustom &R) const {
47264715
return ExceptDoubleParentheses == R.ExceptDoubleParentheses &&
4727-
InAttributeSpecifiers == R.InAttributeSpecifiers &&
47284716
InConditionalStatements == R.InConditionalStatements &&
47294717
InCStyleCasts == R.InCStyleCasts &&
47304718
InEmptyParentheses == R.InEmptyParentheses && Other == R.Other;
@@ -4743,7 +4731,7 @@ struct FormatStyle {
47434731
/// # Example of usage:
47444732
/// SpacesInParens: Custom
47454733
/// SpacesInParensOptions:
4746-
/// InAttributeSpecifiers: false
4734+
/// ExceptDoubleParentheses: false
47474735
/// InConditionalStatements: true
47484736
/// InEmptyParentheses: true
47494737
/// \endcode

clang/lib/Format/Format.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,6 @@ template <> struct MappingTraits<FormatStyle::SpacesInLineComment> {
721721
template <> struct MappingTraits<FormatStyle::SpacesInParensCustom> {
722722
static void mapping(IO &IO, FormatStyle::SpacesInParensCustom &Spaces) {
723723
IO.mapOptional("ExceptDoubleParentheses", Spaces.ExceptDoubleParentheses);
724-
IO.mapOptional("InAttributeSpecifiers", Spaces.InAttributeSpecifiers);
725724
IO.mapOptional("InCStyleCasts", Spaces.InCStyleCasts);
726725
IO.mapOptional("InConditionalStatements", Spaces.InConditionalStatements);
727726
IO.mapOptional("InEmptyParentheses", Spaces.InEmptyParentheses);
@@ -1178,7 +1177,6 @@ template <> struct MappingTraits<FormatStyle> {
11781177
if (SpacesInParentheses) {
11791178
// for backward compatibility.
11801179
Style.SpacesInParensOptions.ExceptDoubleParentheses = false;
1181-
Style.SpacesInParensOptions.InAttributeSpecifiers = true;
11821180
Style.SpacesInParensOptions.InConditionalStatements = true;
11831181
Style.SpacesInParensOptions.InCStyleCasts =
11841182
SpacesInCStyleCastParentheses;

clang/lib/Format/TokenAnnotator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4416,10 +4416,10 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
44164416
if (RightParen && RightParen->is(TT_CastRParen))
44174417
return AddSpace(Style.SpacesInParensOptions.InCStyleCasts);
44184418
if (IsAttributeParen(LeftParen) || IsAttributeParen(RightParen))
4419-
return AddSpace(Style.SpacesInParensOptions.InAttributeSpecifiers);
4419+
return AddSpace(Style.SpacesInParensOptions.Other);
44204420
if ((LeftParen && IsAttributeParen(LeftParen->Previous)) ||
44214421
(RightParen && IsAttributeParen(RightParen->Next))) {
4422-
return AddSpace(Style.SpacesInParensOptions.InAttributeSpecifiers);
4422+
return AddSpace(Style.SpacesInParensOptions.Other);
44234423
}
44244424
return AddSpace(Style.SpacesInParensOptions.Other);
44254425
}

clang/unittests/Format/ConfigParseTest.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ TEST(ConfigParseTest, ParsesConfigurationBools) {
236236
CHECK_PARSE_NESTED_BOOL(SpaceBeforeParensOptions, AfterPlacementOperator);
237237
CHECK_PARSE_NESTED_BOOL(SpaceBeforeParensOptions, BeforeNonEmptyParentheses);
238238
CHECK_PARSE_NESTED_BOOL(SpacesInParensOptions, ExceptDoubleParentheses);
239-
CHECK_PARSE_NESTED_BOOL(SpacesInParensOptions, InAttributeSpecifiers);
240239
CHECK_PARSE_NESTED_BOOL(SpacesInParensOptions, InCStyleCasts);
241240
CHECK_PARSE_NESTED_BOOL(SpacesInParensOptions, InConditionalStatements);
242241
CHECK_PARSE_NESTED_BOOL(SpacesInParensOptions, InEmptyParentheses);

clang/unittests/Format/FormatTest.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17102,7 +17102,6 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) {
1710217102
Spaces.SpacesInParensOptions = {};
1710317103
Spaces.SpacesInParensOptions.Other = true;
1710417104
Spaces.SpacesInParensOptions.InConditionalStatements = true;
17105-
Spaces.SpacesInParensOptions.InAttributeSpecifiers = true;
1710617105
verifyFormat("do_something( ::globalVar );", Spaces);
1710717106
verifyFormat("call( x, y, z );", Spaces);
1710817107
verifyFormat("call();", Spaces);
@@ -17323,7 +17322,7 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) {
1732317322
Spaces.IndentWidth = 2;
1732417323
Spaces.SpacesInParens = FormatStyle::SIPO_Custom;
1732517324
Spaces.SpacesInParensOptions = {};
17326-
Spaces.SpacesInParensOptions.InAttributeSpecifiers = true;
17325+
Spaces.SpacesInParensOptions.Other = true;
1732717326
verifyFormat("SomeType *__attribute__( ( attr ) ) *a = NULL;", Spaces);
1732817327
verifyFormat("void __attribute__( ( naked ) ) foo(int bar)", Spaces);
1732917328
verifyFormat("void f() __attribute__( ( asdf ) );", Spaces);
@@ -17341,7 +17340,7 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) {
1734117340
verifyFormat("class __declspec( dllimport ) X {};", Spaces);
1734217341
verifyFormat("class __declspec(( dllimport )) X {};", Spaces);
1734317342

17344-
Spaces.SpacesInParensOptions.InAttributeSpecifiers = false;
17343+
Spaces.SpacesInParensOptions.Other = false;
1734517344
verifyFormat("SomeType *__attribute__((attr)) *a = NULL;", Spaces);
1734617345
verifyFormat("void __attribute__((naked)) foo(int bar)", Spaces);
1734717346
verifyFormat("void f() __attribute__((asdf));", Spaces);

0 commit comments

Comments
 (0)