[clang] [Clang] Unify interface for accessing template arguments as written for class/variable template specializations (PR #81642)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 14 11:17:54 PST 2024


================
@@ -6316,6 +6310,15 @@ TEST(HasAnyTemplateArgumentLoc, BindsToSpecializationWithDoubleArgument) {
                       hasTypeLoc(loc(asString("double")))))))))));
 }
 
+TEST(HasAnyTemplateArgumentLoc, BindsToExplicitSpecializationWithIntArgument) {
+  EXPECT_TRUE(
+      matches("template<typename T> class A {}; template<> class A<int> {};",
+              classTemplateSpecializationDecl(
+                  hasName("A"), hasAnyTemplateArgument(templateArgument(
+                                    refersToType(asString("int")))))));
+}
+
+#if 0
----------------
sdkrystian wrote:

Oh, hah. I was checking whether we could still match class template specializations based on template arguments. The commented out tests should be replaced with equivalents written using the above syntax (where it makes sense).

So to answer your question, it's from local testing :)

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


More information about the cfe-commits mailing list