Skip to content

Commit

Permalink
Exteded test of .
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354136 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
ymand committed Feb 15, 2019
1 parent 39e2d13 commit e0d0812
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,23 +540,27 @@ TEST(MatcherCXXMemberCallExpr, OnImplicitObjectArgument) {
}

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) {
Expand Down

0 comments on commit e0d0812

Please sign in to comment.