diff options
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp')
| -rw-r--r-- | clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp index 7426dd926d8..1e7b10e99e7 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp @@ -1354,6 +1354,16 @@ TEST(Matcher, HandlesNullQualTypes) { )))))); } +TEST(ObjCIvarRefExprMatcher, IvarExpr) { + std::string ObjCString = + "@interface A @end " + "@implementation A { A *x; } - (void) func { x = 0; } @end"; + EXPECT_TRUE(matchesObjC(ObjCString, objcIvarRefExpr())); + EXPECT_TRUE(matchesObjC(ObjCString, objcIvarRefExpr( + hasDeclaration(namedDecl(hasName("x")))))); + EXPECT_FALSE(matchesObjC(ObjCString, objcIvarRefExpr( + hasDeclaration(namedDecl(hasName("y")))))); +} TEST(StatementCountIs, FindsNoStatementsInAnEmptyCompoundStatement) { EXPECT_TRUE(matches("void f() { }", |

