@@ -4413,31 +4413,29 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
44134413 Right.MatchingParen == &Left && Line.Children .empty ()) {
44144414 return Style.SpaceInEmptyBlock ;
44154415 }
4416- if ((Left.is (tok::l_paren) && Right.is (tok::r_paren)) ||
4417- (Left.is (tok::l_brace) && Left.isNot (BK_Block) &&
4418- Right.is (tok::r_brace) && Right.isNot (BK_Block))) {
4419- return Style.SpacesInParensOptions .InEmptyParentheses ;
4420- }
4421- if (Style.SpacesInParens == FormatStyle::SIPO_Custom &&
4422- Style.SpacesInParensOptions .ExceptDoubleParentheses &&
4423- Left.is (tok::r_paren) && Right.is (tok::r_paren)) {
4424- auto *InnerLParen = Left.MatchingParen ;
4425- if (InnerLParen && InnerLParen->Previous == Right.MatchingParen ) {
4426- InnerLParen->SpacesRequiredBefore = 0 ;
4427- return false ;
4416+ if (Style.SpacesInParens == FormatStyle::SIPO_Custom) {
4417+ if ((Left.is (tok::l_paren) && Right.is (tok::r_paren)) ||
4418+ (Left.is (tok::l_brace) && Left.isNot (BK_Block) &&
4419+ Right.is (tok::r_brace) && Right.isNot (BK_Block))) {
4420+ return Style.SpacesInParensOptions .InEmptyParentheses ;
4421+ }
4422+ if (Style.SpacesInParensOptions .ExceptDoubleParentheses &&
4423+ Left.is (tok::r_paren) && Right.is (tok::r_paren)) {
4424+ auto *InnerLParen = Left.MatchingParen ;
4425+ if (InnerLParen && InnerLParen->Previous == Right.MatchingParen ) {
4426+ InnerLParen->SpacesRequiredBefore = 0 ;
4427+ return false ;
4428+ }
44284429 }
4429- }
4430- if (Style.SpacesInParensOptions .InConditionalStatements ) {
44314430 const FormatToken *LeftParen = nullptr ;
44324431 if (Left.is (tok::l_paren))
44334432 LeftParen = &Left;
44344433 else if (Right.is (tok::r_paren) && Right.MatchingParen )
44354434 LeftParen = Right.MatchingParen ;
4436- if (LeftParen) {
4437- if (LeftParen->is (TT_ConditionLParen))
4438- return true ;
4439- if (LeftParen->Previous && isKeywordWithCondition (*LeftParen->Previous ))
4440- return true ;
4435+ if (LeftParen && (LeftParen->is (TT_ConditionLParen) ||
4436+ (LeftParen->Previous &&
4437+ isKeywordWithCondition (*LeftParen->Previous )))) {
4438+ return Style.SpacesInParensOptions .InConditionalStatements ;
44414439 }
44424440 }
44434441
0 commit comments