[clang] [clang-format] Correctly annotate token-pasted function decl names (PR #142337)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 2 01:18:12 PDT 2025
================
@@ -2257,6 +2257,13 @@ TEST_F(TokenAnnotatorTest, UnderstandsFunctionDeclarationNames) {
EXPECT_TOKEN(Tokens[1], tok::identifier, TT_FunctionDeclarationName);
EXPECT_TOKEN(Tokens[2], tok::l_paren, TT_FunctionDeclarationLParen);
+ Tokens = annotate("#define FUNC(foo, bar) \\\n"
+ " auto foo##bar() -> Type {}");
+ ASSERT_EQ(Tokens.size(), 19u) << Tokens;
+ EXPECT_TOKEN(Tokens[9], tok::identifier, TT_FunctionDeclarationName);
+ EXPECT_TOKEN(Tokens[12], tok::l_paren, TT_FunctionDeclarationLParen);
+ EXPECT_TOKEN(Tokens[14], tok::arrow, TT_TrailingReturnArrow);
+
----------------
HazardyKnusperkeks wrote:
Shouldn't we add some of the stuff, which were wrong on the last try?
https://github.com/llvm/llvm-project/pull/142337
More information about the cfe-commits
mailing list