Skip to content

Commit 53d7d27

Browse files
committed
Fix style problems
1 parent 9122987 commit 53d7d27

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

clang/lib/Format/Format.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,8 +750,10 @@ template <> struct MappingTraits<FormatStyle::SpacesInLineComment> {
750750
}
751751
};
752752

753-
template <> struct ScalarEnumerationTraits<FormatStyle::SpacesInParensCustomStyle> {
754-
static void enumeration(IO &IO, FormatStyle::SpacesInParensCustomStyle &Value) {
753+
template <>
754+
struct ScalarEnumerationTraits<FormatStyle::SpacesInParensCustomStyle> {
755+
static void enumeration(IO &IO,
756+
FormatStyle::SpacesInParensCustomStyle &Value) {
755757
IO.enumCase(Value, "Never", FormatStyle::SIPCS_Never);
756758
IO.enumCase(Value, "NonConsecutive", FormatStyle::SIPCS_NonConsecutive);
757759
IO.enumCase(Value, "Always", FormatStyle::SIPCS_Always);
@@ -1199,7 +1201,8 @@ template <> struct MappingTraits<FormatStyle> {
11991201
if (SpacesInParentheses) {
12001202
// set all options except InCStyleCasts and InEmptyParentheses
12011203
// to true for backward compatibility.
1202-
Style.SpacesInParensOptions.InAttributeSpecifiers = FormatStyle::SIPCS_Always;
1204+
Style.SpacesInParensOptions.InAttributeSpecifiers =
1205+
FormatStyle::SIPCS_Always;
12031206
Style.SpacesInParensOptions.InConditionalStatements = true;
12041207
Style.SpacesInParensOptions.InCStyleCasts =
12051208
SpacesInCStyleCastParentheses;

clang/lib/Format/TokenAnnotator.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4012,10 +4012,14 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
40124012
const auto isAttributeParen = [](const FormatToken *Paren) {
40134013
return Paren && Paren->isOneOf(TT_AttributeLParen, TT_AttributeRParen);
40144014
};
4015-
if (isAttributeParen(&Left) || isAttributeParen(&Right))
4016-
return Style.SpacesInParensOptions.InAttributeSpecifiers == FormatStyle::SIPCS_Always;
4017-
if (isAttributeParen(Left.Previous) || isAttributeParen(Right.Next))
4018-
return Style.SpacesInParensOptions.InAttributeSpecifiers != FormatStyle::SIPCS_Never;
4015+
if (isAttributeParen(&Left) || isAttributeParen(&Right)) {
4016+
return Style.SpacesInParensOptions.InAttributeSpecifiers ==
4017+
FormatStyle::SIPCS_Always;
4018+
}
4019+
if (isAttributeParen(Left.Previous) || isAttributeParen(Right.Next)) {
4020+
return Style.SpacesInParensOptions.InAttributeSpecifiers !=
4021+
FormatStyle::SIPCS_Never;
4022+
}
40194023
return Style.SpacesInParensOptions.Other;
40204024
}
40214025
if (Right.isOneOf(tok::semi, tok::comma))

0 commit comments

Comments
 (0)