[clang] [clang-format] Don't count template template parameter as declaration (PR #95025)
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 11 18:54:04 PDT 2024
================
@@ -584,6 +584,23 @@ TEST_F(TokenAnnotatorTest, UnderstandsNonTemplateAngleBrackets) {
EXPECT_TOKEN(Tokens[20], tok::greater, TT_BinaryOperator);
}
+TEST_F(TokenAnnotatorTest, UnderstandsTemplateTemplateParameters) {
+ auto Tokens = annotate("template <template <typename...> typename X,\n"
+ " template <typename...> typename Y,\n"
+ " typename... T>\n"
+ "class A {};");
+ ASSERT_EQ(Tokens.size(), 28u) << Tokens;
+ EXPECT_TOKEN(Tokens[1], tok::less, TT_TemplateOpener);
+ EXPECT_TOKEN(Tokens[3], tok::less, TT_TemplateOpener);
+ EXPECT_TOKEN(Tokens[6], tok::greater, TT_TemplateCloser);
+ EXPECT_EQ(Tokens[6]->ClosesTemplateDeclaration, 0u);
----------------
owenca wrote:
```suggestion
EXPECT_FALSE(Tokens[6]->ClosesTemplateDeclaration);
```
https://github.com/llvm/llvm-project/pull/95025
More information about the cfe-commits
mailing list