[clang] [clang-format] Don't count template template parameter as declaration (PR #95025)

Emilia Kond via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 12 05:38:35 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);
----------------
rymiel wrote:

Thanks, some existing tests had this pattern so I followed those but EXPECT_TRUE and EXPECT_FALSE make more sense

https://github.com/llvm/llvm-project/pull/95025


More information about the cfe-commits mailing list