diff options
author | c8ef <c8ef@outlook.com> | 2024-06-11 00:10:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-10 09:10:30 -0700 |
commit | d9593c1edd7add74564cf950cd209fc35f5261b6 (patch) | |
tree | 55d17b7c46c52ce8a764d063a74659ca8dee946b /clang/lib/Format/ContinuationIndenter.cpp | |
parent | 39f09e8dcd9ceff5c5030ede6393155782b7cdad (diff) | |
download | llvm-d9593c1edd7add74564cf950cd209fc35f5261b6.zip llvm-d9593c1edd7add74564cf950cd209fc35f5261b6.tar.gz llvm-d9593c1edd7add74564cf950cd209fc35f5261b6.tar.bz2 |
[clang-format] Fix a bug in indenting lambda trailing arrows (#94560)
Closes #94181
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index be684ac..b073604 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -1257,6 +1257,11 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) { } return CurrentState.Indent; } + if (Current.is(TT_TrailingReturnArrow) && + Previous.isOneOf(tok::kw_noexcept, tok::kw_mutable, tok::kw_constexpr, + tok::kw_consteval, tok::kw_static, TT_AttributeSquare)) { + return ContinuationIndent; + } if ((Current.isOneOf(tok::r_brace, tok::r_square) || (Current.is(tok::greater) && (Style.isProto() || Style.isTableGen()))) && State.Stack.size() > 1) { |