[clang] [clang-format] Allow line breaking with PointerAlignment configured (PR #164686)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 23 06:04:33 PDT 2025
================
@@ -6262,8 +6262,10 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
TT_ClassHeadName, TT_QtProperty, tok::kw_operator)) {
return true;
}
+ // It is fine to break the line when the * or & should be separate from the
+ // name according to the PointerAlignment config.
if (Left.is(TT_PointerOrReference))
- return false;
+ return Right.SpacesRequiredBefore;
----------------
sstwcw wrote:
Different things can follow a star or amp. The rule is complicated. It takes up lines 4743 through 4780 in the `spaceRequiredBetween` function.
https://github.com/llvm/llvm-project/pull/164686
More information about the cfe-commits
mailing list