[clang] [clang-format] Allow line breaking with PointerAlignment configured (PR #164686)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 27 13:16:44 PDT 2025
================
@@ -8644,6 +8644,38 @@ TEST_F(FormatTest, BreaksFunctionDeclarations) {
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}",
Style);
+ Style.ColumnLimit = 70;
+ verifyFormat(
+ "void foo( //\n"
+ " const MySuperSuperSuperSuperSuperSuperSuperSuperLongTypeName*\n"
+ " const my_super_super_super_super_long_variable_name) {}",
+ Style);
+ verifyFormat(
+ "void foo(const MySuperSuperSuperSuperSuperSuperSuperSuperLongTypeName*\n"
+ " my_super_super_super_super_long_variable_name) {}",
+ Style);
+ verifyFormat(
+ "void foo(const MySuperSuperSuperSuperSuperSuperSuperSuperLongTypeName*\n"
+ " const my_super_super_super_super_long_variable_name) {}",
+ Style);
+
+ Style.PointerAlignment = FormatStyle::PAS_Middle;
+ verifyFormat(
----------------
HazardyKnusperkeks wrote:
`Type * const arg` and `Type * const` is too long for the `ColumnLimit`, where to break? We are within the type.
https://github.com/llvm/llvm-project/pull/164686
More information about the cfe-commits
mailing list