]> granicus.if.org Git - clang/commitdiff
Make the negative test of recordType depend on a specific record.
authorManuel Klimek <klimek@google.com>
Wed, 27 Feb 2013 11:56:58 +0000 (11:56 +0000)
committerManuel Klimek <klimek@google.com>
Wed, 27 Feb 2013 11:56:58 +0000 (11:56 +0000)
Otherwise it'll break if there's a record type in the AST by default.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176181 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/ASTMatchers/ASTMatchersTest.cpp

index 565c356235fc6e58d6ef191e2e4e4a8dbecd693b..53620a029425e3f5149c14674a0712291fc9b36a 100644 (file)
@@ -3436,8 +3436,10 @@ TEST(TypeMatching, MatchesTemplateSpecializationType) {
 
 TEST(TypeMatching, MatchesRecordType) {
   EXPECT_TRUE(matches("class C{}; C c;", recordType()));
-  EXPECT_TRUE(matches("struct S{}; S s;", recordType()));
-  EXPECT_TRUE(notMatches("int i;", recordType()));
+  EXPECT_TRUE(matches("struct S{}; S s;",
+                      recordType(hasDeclaration(recordDecl(hasName("S"))))));
+  EXPECT_TRUE(notMatches("int i;",
+                         recordType(hasDeclaration(recordDecl(hasName("S"))))));
 }
 
 TEST(TypeMatching, MatchesElaboratedType) {