github-actions[bot] wrote: <!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning: <details> <summary> You can test this locally with the following command: </summary> ``````````bash git-clang-format --diff 75efddba0f507282df479a6e296d67fd88aed489 79b4c34eba3a96d869cf4bfc0f0d2ff358bf1b42 -- clang/include/clang/Format/Format.h clang/lib/Format/Format.cpp clang/lib/Format/TokenAnnotator.cpp clang/unittests/Format/ConfigParseTest.cpp clang/unittests/Format/FormatTest.cpp clang/unittests/Format/FormatTestVerilog.cpp `````````` </details> <details> <summary> View the diff from clang-format here. </summary> ``````````diff diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index 2a6ec4a2e0..1dbae49ae5 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -4623,16 +4623,15 @@ struct FormatStyle { /// Never: /// t f(Deleted &) & = delete; /// decltype((x)) - /// x = ((int32))y + /// x = ((int32))y /// y = ((int (*)(int))foo)(x); /// \endcode SpacesInParensCustomStyle Other; SpacesInParensCustom() : InAttributeSpecifiers(SIPCS_Never), - InConditionalStatements(SIPCS_Never), - InCStyleCasts(SIPCS_Never), InEmptyParentheses(false), - Other(SIPCS_Never) {} + InConditionalStatements(SIPCS_Never), InCStyleCasts(SIPCS_Never), + InEmptyParentheses(false), Other(SIPCS_Never) {} SpacesInParensCustom(SpacesInParensCustomStyle InAttributeSpecifiers, SpacesInParensCustomStyle InConditionalStatements, diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 6eddebea4e..fc924912ec 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -3549,7 +3549,9 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const { const FormatToken *Prev = Current->Previous; if (Current->is(TT_LineComment)) { if (Prev->is(BK_BracedInit) && Prev->opensScope()) { - Current->SpacesRequiredBefore = (Style.Cpp11BracedListStyle && Style.SpacesInParensOptions.Other == FormatStyle::SIPCS_Never) + Current->SpacesRequiredBefore = + (Style.Cpp11BracedListStyle && + Style.SpacesInParensOptions.Other == FormatStyle::SIPCS_Never) ? 0 : 1; } else if (Prev->is(TT_VerilogMultiLineListLParen)) { @@ -3967,8 +3969,9 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, Right.is(tok::r_brace) && Right.isNot(BK_Block))) { return Style.SpacesInParensOptions.InEmptyParentheses; } - if (Style.SpacesInParensOptions.InConditionalStatements != FormatStyle::SIPCS_Never) { - // TODO: check consecutive parens + if (Style.SpacesInParensOptions.InConditionalStatements != + FormatStyle::SIPCS_Never) { + // TODO: check consecutive parens const FormatToken *LeftParen = nullptr; if (Left.is(tok::l_paren)) LeftParen = &Left; @@ -4245,8 +4248,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, if ((Left.is(tok::l_brace) && Left.isNot(BK_Block)) || (Right.is(tok::r_brace) && Right.MatchingParen && Right.MatchingParen->isNot(BK_Block))) { - return !Style.Cpp11BracedListStyle || (Style.SpacesInParensOptions.Other != - FormatStyle::SIPCS_Never); + return !Style.Cpp11BracedListStyle || + (Style.SpacesInParensOptions.Other != FormatStyle::SIPCS_Never); } if (Left.is(TT_BlockComment)) { // No whitespace in x(/*foo=*/1), except for JavaScript. @@ -4932,8 +4935,8 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, !(Left.isOneOf(tok::l_paren, tok::r_paren, tok::l_square, tok::kw___super, TT_TemplateOpener, TT_TemplateCloser)) || - (Left.is(tok::l_paren) && Style.SpacesInParensOptions.Other != - FormatStyle::SIPCS_Always); + (Left.is(tok::l_paren) && + Style.SpacesInParensOptions.Other != FormatStyle::SIPCS_Always); } if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser))) return ShouldAddSpacesInAngles(); diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp index f9720663a6..8e114b9577 100644 --- a/clang/unittests/Format/ConfigParseTest.cpp +++ b/clang/unittests/Format/ConfigParseTest.cpp @@ -654,27 +654,27 @@ TEST(ConfigParseTest, ParsesConfiguration) { Style.SpacesInParens = FormatStyle::SIPO_Never; Style.SpacesInParensOptions = {}; CHECK_PARSE("SpacesInParentheses: true", SpacesInParensOptions, - FormatStyle::SpacesInParensCustom(FormatStyle::SIPCS_Always, - FormatStyle::SIPCS_Always, FormatStyle::SIPCS_Never, false, - FormatStyle::SIPCS_Always)); + FormatStyle::SpacesInParensCustom( + FormatStyle::SIPCS_Always, FormatStyle::SIPCS_Always, + FormatStyle::SIPCS_Never, false, FormatStyle::SIPCS_Always)); Style.SpacesInParens = FormatStyle::SIPO_Never; Style.SpacesInParensOptions = {}; CHECK_PARSE("SpacesInConditionalStatement: true", SpacesInParensOptions, - FormatStyle::SpacesInParensCustom(FormatStyle::SIPCS_Never, - FormatStyle::SIPCS_Always, FormatStyle::SIPCS_Never, false, - FormatStyle::SIPCS_Never)); + FormatStyle::SpacesInParensCustom( + FormatStyle::SIPCS_Never, FormatStyle::SIPCS_Always, + FormatStyle::SIPCS_Never, false, FormatStyle::SIPCS_Never)); Style.SpacesInParens = FormatStyle::SIPO_Never; Style.SpacesInParensOptions = {}; CHECK_PARSE("SpacesInCStyleCastParentheses: true", SpacesInParensOptions, - FormatStyle::SpacesInParensCustom(FormatStyle::SIPCS_Never, - FormatStyle::SIPCS_Never, FormatStyle::SIPCS_Always, false, - FormatStyle::SIPCS_Never)); + FormatStyle::SpacesInParensCustom( + FormatStyle::SIPCS_Never, FormatStyle::SIPCS_Never, + FormatStyle::SIPCS_Always, false, FormatStyle::SIPCS_Never)); Style.SpacesInParens = FormatStyle::SIPO_Never; Style.SpacesInParensOptions = {}; CHECK_PARSE("SpaceInEmptyParentheses: true", SpacesInParensOptions, - FormatStyle::SpacesInParensCustom(FormatStyle::SIPCS_Never, - FormatStyle::SIPCS_Never, FormatStyle::SIPCS_Never, true, - FormatStyle::SIPCS_Never)); + FormatStyle::SpacesInParensCustom( + FormatStyle::SIPCS_Never, FormatStyle::SIPCS_Never, + FormatStyle::SIPCS_Never, true, FormatStyle::SIPCS_Never)); Style.SpacesInParens = FormatStyle::SIPO_Never; Style.SpacesInParensOptions = {}; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 208be4746c..002862bc3b 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -16907,7 +16907,7 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) { FormatStyle::SIPCS_NonConsecutive; verifyFormat("SomeType *__attribute__(( attr )) *a = NULL;", Spaces); verifyFormat("void __attribute__(( naked )) foo(int bar)", Spaces); - verifyFormat("void f( ) __attribute__(( asdf ));", Spaces); + verifyFormat("void f( ) __attribute__(( asdf ));", Spaces); Spaces.SpacesInParensOptions.InAttributeSpecifiers = FormatStyle::SIPCS_Never; // Run the first set of tests again with: `````````` </details> https://github.com/llvm/llvm-project/pull/77522 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits