================ @@ -3180,6 +3180,18 @@ TEST_F(TokenAnnotatorTest, FunctionTryBlock) { EXPECT_TOKEN(Tokens[36], tok::l_brace, TT_FunctionLBrace); } +TEST_F(TokenAnnotatorTest, TypenameMacro) { + auto Style = getLLVMStyle(); + Style.TypenameMacros.push_back("STRUCT"); + + auto Tokens = annotate("STRUCT(T, B) { int i; };", Style); + ASSERT_EQ(Tokens.size(), 13u); + EXPECT_TOKEN(Tokens[0], tok::identifier, TT_TypenameMacro); + EXPECT_TOKEN(Tokens[1], tok::l_paren, TT_TypeDeclarationParen); + EXPECT_TOKEN(Tokens[5], tok::r_paren, TT_TypeDeclarationParen); + EXPECT_TOKEN(Tokens[6], tok::l_brace, TT_Unknown); ---------------- owenca wrote:
> Is `TT_Unknown` the correct type? Yes. We use it to verify that a token is not annotated (incorrectly). > I know we can't really say if it's a `TT_StructLBrace` or `TT_ClassLBrace` > (or even `TT_UnionLBrace`), but would it harm to just guess one of them? Or `TT_EnumLBrace` or anyone in [here](https://github.com/llvm/llvm-project/pull/93634#issuecomment-2156968344). We shouldn’t make a wild guess because the type of the braces depends on how the macro is defined (and on what’s between the braces). https://github.com/llvm/llvm-project/pull/96026 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits