aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Format/ContinuationIndenter.cpp
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2024-02-07 20:24:44 -0800
committerGitHub <noreply@github.com>2024-02-07 20:24:44 -0800
commitd033799050b7bda70d80a933d5d99b7088a72a95 (patch)
tree086c70ef55d2f6736a73aa443451a2724dc901f6 /clang/lib/Format/ContinuationIndenter.cpp
parent05091aa3ac53a13d08c78882c0c2035e58a1b4c4 (diff)
downloadllvm-d033799050b7bda70d80a933d5d99b7088a72a95.zip
llvm-d033799050b7bda70d80a933d5d99b7088a72a95.tar.gz
llvm-d033799050b7bda70d80a933d5d99b7088a72a95.tar.bz2
[clang-format] Add Leave to AlwaysBreakTemplateDeclarations (#80569)
Closes #78067.
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 671ae54..7fd04b2 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -569,7 +569,10 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
return true;
}
}
- return Style.AlwaysBreakTemplateDeclarations != FormatStyle::BTDS_No;
+ return Style.AlwaysBreakTemplateDeclarations != FormatStyle::BTDS_No &&
+ (Style.AlwaysBreakTemplateDeclarations !=
+ FormatStyle::BTDS_Leave ||
+ Current.NewlinesBefore > 0);
}
if (Previous.is(TT_FunctionAnnotationRParen) &&
State.Line->Type != LT_PreprocessorDirective) {