[PATCH] D57235: [AST] Add structural eq tests for template args

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 28 02:01:20 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rC352345: [AST] Add structural eq tests for template args (authored by martong, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D57235?vs=183525&id=183810#toc

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57235/new/

https://reviews.llvm.org/D57235

Files:
  unittests/AST/StructuralEquivalenceTest.cpp


Index: unittests/AST/StructuralEquivalenceTest.cpp
===================================================================
--- unittests/AST/StructuralEquivalenceTest.cpp
+++ unittests/AST/StructuralEquivalenceTest.cpp
@@ -802,6 +802,25 @@
   EXPECT_FALSE(testStructuralMatch(t));
 }
 
+struct StructuralEquivalenceTemplateTest : StructuralEquivalenceTest {};
+
+TEST_F(StructuralEquivalenceTemplateTest, ExactlySameTemplates) {
+  auto t = makeNamedDecls("template <class T> struct foo;",
+                          "template <class T> struct foo;", Lang_CXX);
+  EXPECT_TRUE(testStructuralMatch(t));
+}
+
+TEST_F(StructuralEquivalenceTemplateTest, DifferentTemplateArgName) {
+  auto t = makeNamedDecls("template <class T> struct foo;",
+                          "template <class U> struct foo;", Lang_CXX);
+  EXPECT_TRUE(testStructuralMatch(t));
+}
+
+TEST_F(StructuralEquivalenceTemplateTest, DifferentTemplateArgKind) {
+  auto t = makeNamedDecls("template <class T> struct foo;",
+                          "template <int T> struct foo;", Lang_CXX);
+  EXPECT_FALSE(testStructuralMatch(t));
+}
 
 } // end namespace ast_matchers
 } // end namespace clang


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57235.183810.patch
Type: text/x-patch
Size: 1159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190128/349bab70/attachment.bin>


More information about the cfe-commits mailing list