[clang] [clang-format] add option to bin-pack keyworded parameters (PR #131605)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 17 12:37:10 PDT 2025
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 17b4be8f63a9a2c17290c8540d84f17a370b1915 3cffb6a3c8a4bda050b56900d0333aed1cbe0216 --extensions cpp,h -- clang/include/clang/Format/Format.h clang/lib/Format/ContinuationIndenter.cpp clang/lib/Format/Format.cpp clang/lib/Format/FormatToken.cpp clang/lib/Format/FormatToken.h clang/lib/Format/TokenAnnotator.cpp clang/unittests/Format/FormatTest.cpp
``````````
</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 c08fc7d6c7..efb08c1dcc 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -29108,44 +29108,49 @@ TEST_F(FormatTest, FunctionDeclarationWithKeywords) {
Style40.FunctionDeclarationsWithKeywords.push_back(QPropertyDeclaration);
Style40.BinPackParameters = FormatStyle::BPPS_OnePerLine;
- verifyFormat("Q_PROPERTY(int name\n"
- " READ name\n"
- " WRITE setName\n"
- " NOTIFY nameChanged)",
- "Q_PROPERTY(int name READ name WRITE setName NOTIFY nameChanged)",
- Style40);
+ verifyFormat(
+ "Q_PROPERTY(int name\n"
+ " READ name\n"
+ " WRITE setName\n"
+ " NOTIFY nameChanged)",
+ "Q_PROPERTY(int name READ name WRITE setName NOTIFY nameChanged)",
+ Style40);
verifyFormat("class A {\n"
" Q_PROPERTY(int name\n"
" READ name\n"
" WRITE setName\n"
" NOTIFY nameChanged)\n"
"};",
- "class A { Q_PROPERTY(int name READ name WRITE setName NOTIFY nameChanged) };",
+ "class A { Q_PROPERTY(int name READ name WRITE setName NOTIFY "
+ "nameChanged) };",
Style40);
auto Style120 = getLLVMStyleWithColumns(120);
Style120.FunctionDeclarationsWithKeywords.push_back(QPropertyDeclaration);
Style120.BinPackParameters = FormatStyle::BPPS_AlwaysOnePerLine;
- verifyFormat("Q_PROPERTY(int name\n"
- " READ name\n"
- " WRITE setName\n"
- " NOTIFY nameChanged)",
- "Q_PROPERTY(int name READ name WRITE setName NOTIFY nameChanged)",
- Style120);
+ verifyFormat(
+ "Q_PROPERTY(int name\n"
+ " READ name\n"
+ " WRITE setName\n"
+ " NOTIFY nameChanged)",
+ "Q_PROPERTY(int name READ name WRITE setName NOTIFY nameChanged)",
+ Style120);
verifyFormat("class A {\n"
" Q_PROPERTY(int name\n"
" READ name\n"
" WRITE setName\n"
" NOTIFY nameChanged)\n"
"};",
- "class A { Q_PROPERTY(int name READ name WRITE setName NOTIFY nameChanged) };",
+ "class A { Q_PROPERTY(int name READ name WRITE setName NOTIFY "
+ "nameChanged) };",
Style120);
Style120.BinPackParameters = FormatStyle::BPPS_BinPack;
- verifyFormat("Q_PROPERTY(int name READ name WRITE setName NOTIFY nameChanged)",
- Style120);
+ verifyFormat(
+ "Q_PROPERTY(int name READ name WRITE setName NOTIFY nameChanged)",
+ Style120);
}
} // namespace
``````````
</details>
https://github.com/llvm/llvm-project/pull/131605
More information about the cfe-commits
mailing list