================
@@ -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 looked into it. Now I can't figure out whether the formatter should break
> the line between the type and the star when middle is configured. I thought
> that the default right style was for people who read "the expression `*x` is
> of type `int`", while the left and middle styles were for people who read
> "the variable `x` is of type `int*`". Then it seems that the program should
> avoid breaking between the type and the star when the style is left or
> middle. However, the code says that the program should break the line between
> the `*const` part and the variable when right is selected (pull request
> #128817, bug report #28919). That seems to contradict my understanding about
> the styles. What is the reasoning behind the pull request?
The `TT_PointerOrReference` token (`*`, `&`, or `&&`) before a declarator is
part of the type and should not go with the declarator, so wrapping before `*`
doesn't make sense IMO.
https://github.com/llvm/llvm-project/pull/164686
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits