[clang] [clang-format] Fix a bug in annotating TrailingReturnArrow (PR #69249)
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 17 17:17:01 PDT 2023
================
@@ -3497,6 +3497,15 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const {
Tok->setType(TT_TrailingReturnArrow);
break;
}
+ if (Tok->isNot(TT_TrailingAnnotation))
----------------
owenca wrote:
Before: look for _any_ arrow after the `r_paren` of the function declaration.
Now: look for any arrow _except_ when inside the parentheses after a `TT_TrailingAnnotation`.
The case where `Next` is `nullptr` is handled by the condition of the `for` loop whereas any tokens (including non-`l_parens`) before a `TT_TrailingAnnotation` should be skipped as before.
https://github.com/llvm/llvm-project/pull/69249
More information about the cfe-commits
mailing list