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 origin/main HEAD --extensions cpp,h -- clang/include/clang/Format/Format.h clang/lib/Format/Format.cpp clang/lib/Format/TokenAnnotator.cpp clang/unittests/Format/FormatTest.cpp `````````` :warning: The reproduction instructions above might return results for more than one PR in a stack if you are using a stacked PR workflow. You can limit the results by changing `origin/main` to the base branch/commit you want to compare against. :warning: </details> <details> <summary> View the diff from clang-format here. </summary> ``````````diff diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 4ca1f8fbf..4fd73ebed 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -17859,27 +17859,44 @@ TEST_F(FormatTest, SpaceBeforeUnderscoreParens) { // Default LLVM style should have SpaceBeforeUnderscoreParens = true EXPECT_TRUE(Style.SpaceBeforeUnderscoreParens); - verifyFormat("func (arg);", Style); // All functions should have space - verifyFormat("my_func (arg);", Style); // All functions should have space - verifyFormat("_ (message);", Style); // Single underscore should have space when SpaceBeforeUnderscoreParens=true - verifyFormat("underscore_ (param);", Style); // Other underscores should have space - - // Now test with SpaceBeforeUnderscoreParens = false but SpaceBeforeParens = Always + verifyFormat("func (arg);", Style); // All functions should have space + verifyFormat("my_func (arg);", Style); // All functions should have space + verifyFormat("_ (message);", Style); // Single underscore should have space + // when SpaceBeforeUnderscoreParens=true + verifyFormat("underscore_ (param);", + Style); // Other underscores should have space + + // Now test with SpaceBeforeUnderscoreParens = false but SpaceBeforeParens = + // Always Style.SpaceBeforeUnderscoreParens = false; - verifyFormat("func (arg);", Style); // Non-underscore functions should still have space - verifyFormat("my_func (arg);", Style); // Functions with underscores should still have space - verifyFormat("_(message);", Style); // Single underscore (gettext macro) should NOT have space - verifyFormat("underscore_ (param);", Style); // Other underscores should still have space - verifyFormat("_private_func (data);", Style); // Functions starting with underscore but not single _ should have space + verifyFormat("func (arg);", + Style); // Non-underscore functions should still have space + verifyFormat("my_func (arg);", + Style); // Functions with underscores should still have space + verifyFormat( + "_(message);", + Style); // Single underscore (gettext macro) should NOT have space + verifyFormat("underscore_ (param);", + Style); // Other underscores should still have space + verifyFormat("_private_func (data);", + Style); // Functions starting with underscore but not single _ + // should have space // Test GNU style (should have SpaceBeforeUnderscoreParens = false by default) FormatStyle GNUStyle = getGNUStyle(); EXPECT_FALSE(GNUStyle.SpaceBeforeUnderscoreParens); - EXPECT_EQ(GNUStyle.SpaceBeforeParens, FormatStyle::SBPO_Always); // GNU style should have SpaceBeforeParens = Always - verifyFormat("func (arg);", GNUStyle); // GNU style has SpaceBeforeParens = Always - verifyFormat("my_func (arg);", GNUStyle); // Functions with underscores should have space - verifyFormat("_(message);", GNUStyle); // Single underscore (gettext macro) should NOT have space - verifyFormat("_private_func (data);", GNUStyle); // Other functions should have space + EXPECT_EQ(GNUStyle.SpaceBeforeParens, + FormatStyle::SBPO_Always); // GNU style should have + // SpaceBeforeParens = Always + verifyFormat("func (arg);", + GNUStyle); // GNU style has SpaceBeforeParens = Always + verifyFormat("my_func (arg);", + GNUStyle); // Functions with underscores should have space + verifyFormat( + "_(message);", + GNUStyle); // Single underscore (gettext macro) should NOT have space + verifyFormat("_private_func (data);", + GNUStyle); // Other functions should have space // Test mixed scenarios with GNU style verifyFormat("printf (_(\"Hello\"));\n" `````````` </details> https://github.com/llvm/llvm-project/pull/159925 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits