[clang] [clang-format] Don't annotate arrow after a binary operator as trailing return (PR #241555)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 23 16:50:49 PST 2026
================
@@ -2792,6 +2804,15 @@ TEST_F(TokenAnnotatorTest, UnderstandsTrailingReturnArrow) {
EXPECT_TOKEN(Tokens[0], tok::identifier, TT_StatementAttributeLikeMacro);
EXPECT_TOKEN(Tokens[4], tok::arrow, TT_Unknown);
+ Tokens = annotate("DO_DEBUG debug() << foo->bar();");
+ ASSERT_EQ(Tokens.size(), 12u) << Tokens;
+ EXPECT_TOKEN(Tokens[6], tok::arrow, TT_Unknown);
+
+ // A function type in such an expression can still have one.
+ Tokens = annotate("DO_DEBUG debug() << (auto (*)() -> bar)(x);");
----------------
ljkx wrote:
Done in add55fe8: it's now at the end of the trailing return arrow cases, before "Not trailing return arrows".
https://github.com/llvm/llvm-project/pull/241555
More information about the cfe-commits
mailing list