r354136 - Exteded test of .

Yitzhak Mandelbaum via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 15 06:43:11 PST 2019


Author: ymandel
Date: Fri Feb 15 06:43:10 2019
New Revision: 354136

URL: http://llvm.org/viewvc/llvm-project?rev=354136&view=rev
Log:
Exteded test of .

Modified:
    cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp?rev=354136&r1=354135&r2=354136&view=diff
==============================================================================
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp Fri Feb 15 06:43:10 2019
@@ -540,23 +540,27 @@ TEST(MatcherCXXMemberCallExpr, OnImplici
 }
 
 TEST(Matcher, HasObjectExpr) {
-  auto M = memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))));
-  EXPECT_TRUE(matches(
-      R"cc(
+  auto Snippet1 = R"cc(
         struct X {
           int m;
           int f(X x) { return x.m; }
         };
-      )cc",
-      M));
-  EXPECT_TRUE(notMatches(
-      R"cc(
+      )cc";
+  auto Snippet2 = R"cc(
         struct X {
           int m;
           int f(X x) { return m; }
         };
-      )cc",
-      M));
+      )cc";
+  auto MatchesX =
+      memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))));
+  EXPECT_TRUE(matches(Snippet1, MatchesX));
+  EXPECT_TRUE(notMatches(Snippet2, MatchesX));
+
+  auto MatchesXPointer = memberExpr(
+      hasObjectExpression(hasType(pointsTo(cxxRecordDecl(hasName("X"))))));
+  EXPECT_TRUE(notMatches(Snippet1, MatchesXPointer));
+  EXPECT_TRUE(matches(Snippet2, MatchesXPointer));
 }
 
 TEST(ForEachArgumentWithParam, ReportsNoFalsePositives) {




More information about the cfe-commits mailing list