diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2024-05-04 10:19:32 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2024-05-04 15:44:49 +0000 |
commit | 5678d1d98a348f315453555377ccb28821a2ffcd (patch) | |
tree | 9dda9eea3f362a43cae6ec4fa369567efa7002fa /contrib/llvm-project/clang/lib/Format/ContinuationIndenter.cpp | |
parent | 0ad9b235e1eaef36e07247c8c7635a8eac98f4b1 (diff) | |
parent | 9a7cb8417a2a13bcb7a300c65c43960389b85456 (diff) |
Diffstat (limited to 'contrib/llvm-project/clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | contrib/llvm-project/clang/lib/Format/ContinuationIndenter.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/contrib/llvm-project/clang/lib/Format/ContinuationIndenter.cpp b/contrib/llvm-project/clang/lib/Format/ContinuationIndenter.cpp index a3eb9138b218..53cd169b0590 100644 --- a/contrib/llvm-project/clang/lib/Format/ContinuationIndenter.cpp +++ b/contrib/llvm-project/clang/lib/Format/ContinuationIndenter.cpp @@ -674,7 +674,13 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, // arguments to function calls. We do this by ensuring that either all // arguments (including any lambdas) go on the same line as the function // call, or we break before the first argument. - auto PrevNonComment = Current.getPreviousNonComment(); + const auto *Prev = Current.Previous; + if (!Prev) + return false; + // For example, `/*Newline=*/false`. + if (Prev->is(TT_BlockComment) && Current.SpacesRequiredBefore == 0) + return false; + const auto *PrevNonComment = Current.getPreviousNonComment(); if (!PrevNonComment || PrevNonComment->isNot(tok::l_paren)) return false; if (Current.isOneOf(tok::comment, tok::l_paren, TT_LambdaLSquare)) |