================
@@ -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(
----------------
owenca wrote:
> I don't know for whom middle is, but never break between the type and the
> `*`. And I think #28919 makes a good point, the `const` belongs to the type.
> On the other hand violating the column limit, while there is whitespace which
> can be a line break is also bad. I don't really know. Maybe add a huge
> penalty on that? @owenca any opinion?
Maybe set `CanBreakBefore` to false if `*` is followed by a declarator?
https://github.com/llvm/llvm-project/pull/164686
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits