[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 2 14:54:21 PDT 2024
================
@@ -803,6 +803,60 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while,
tok::kw_switch);
};
+ // Detecting functions is brittle. It would be better if we could annotate
+ // the LParen type of functions/calls.
+ const auto IsFunctionDeclParen = [&](const FormatToken &Tok) {
+ return Tok.is(tok::l_paren) && Tok.Previous &&
+ (Tok.Previous->is(TT_FunctionDeclarationName) ||
+ (Tok.Previous->Previous &&
+ Tok.Previous->Previous->is(tok::coloncolon) &&
+ Tok.Previous->Previous->Previous &&
+ Tok.Previous->Previous->Previous->is(TT_FunctionDeclarationName)));
----------------
owenca wrote:
Use `endsSequence()` instead.
https://github.com/llvm/llvm-project/pull/93140
More information about the cfe-commits
mailing list