[clang] Add configuration option PenaltyBreakBeforeMemberAccess (PR #118409)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 27 00:06:59 PST 2025


================
@@ -4316,7 +4316,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
     //   aaaaaaa
     //       .aaaaaaaaa.bbbbbbbb(cccccccc);
     return !Right.NextOperator || !Right.NextOperator->Previous->closesScope()
-               ? 150
+               ? Style.PenaltyBreakBeforeMemberAccess
                : 35;
----------------
owenca wrote:

We probably want this instead:
```cpp
    const auto Penalty = Style.PenaltyBreakBeforeMemberAccess;
    return Right.NextOperator && Right.NextOperator->Previous->closesScope()
               ? std::min(Penalty, 35u)
               : Penalty;
```

https://github.com/llvm/llvm-project/pull/118409


More information about the cfe-commits mailing list