[clang] [clang-format] Add AllowShortType option for AlwaysBreakAfterReturnType. (PR #78011)
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 26 18:31:20 PST 2024
================
@@ -326,11 +326,13 @@ bool ContinuationIndenter::canBreak(const LineState &State) {
return false;
}
- // Don't break after very short return types (e.g. "void") as that is often
- // unexpected.
- if (Current.is(TT_FunctionDeclarationName) && State.Column < 6) {
- if (Style.AlwaysBreakAfterReturnType == FormatStyle::RTBS_None)
+ if (Style.AlwaysBreakAfterReturnType == FormatStyle::RTBS_None) {
+ // Don't break after very short return types (e.g. "void") as that is often
+ // unexpected.
+ if (Current.is(TT_FunctionDeclarationName) &&
+ State.Column - State.FirstIndent < 6) {
----------------
owenca wrote:
We probably need to assert that `State.Column >= State.FirstIndent`.
https://github.com/llvm/llvm-project/pull/78011
More information about the cfe-commits
mailing list