summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
diff options
context:
space:
mode:
authorStephane Moore <mog@google.com>2019-08-12 23:23:35 +0000
committerStephane Moore <mog@google.com>2019-08-12 23:23:35 +0000
commita0a47d8ac113b1e959288698deef847f562921d3 (patch)
tree7389a9dabcd21a82c8143ec15db6fd955a0973a9 /clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
parente9865b9b31bb2e6bc742dc6fca8f9f9517c3c43e (diff)
downloadbcm5719-llvm-a0a47d8ac113b1e959288698deef847f562921d3.tar.gz
bcm5719-llvm-a0a47d8ac113b1e959288698deef847f562921d3.zip
[clang] Update isDerivedFrom to support Objective-C classes 🔍
Summary: This change updates `isDerivedFrom` to support Objective-C classes by converting it to a polymorphic matcher. Notes: The matching behavior for Objective-C classes is modeled to match the behavior of `isDerivedFrom` with C++ classes. To that effect, `isDerivedFrom` matches aliased types of derived Objective-C classes, including compatibility aliases. To achieve this, the AST visitor has been updated to map compatibility aliases to their underlying Objective-C class. `isSameOrDerivedFrom` also provides similar behaviors for C++ and Objective-C classes. The behavior that `cxxRecordDecl(isSameOrDerivedFrom("X"))` does not match `class Y {}; typedef Y X;` is mirrored for Objective-C in that `objcInterfaceDecl(isSameOrDerivedFrom("X"))` does not match either `@interface Y @end typedef Y X;` or `@interface Y @end @compatibility_alias X Y;`. Test Notes: Ran clang unit tests. Reviewers: aaron.ballman, jordan_rose, rjmccall, klimek, alexfh, gribozavr Reviewed By: aaron.ballman, gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60543 llvm-svn: 368632
Diffstat (limited to 'clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp')
-rw-r--r--clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
index cf016a120b1..4e5c0ffe2b4 100644
--- a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
+++ b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
@@ -439,7 +439,7 @@ TEST_F(RegistryTest, Errors) {
Error.get()).isNull());
EXPECT_EQ("Incorrect type for arg 1. "
"(Expected = Matcher<CXXRecordDecl>) != "
- "(Actual = Matcher<CXXRecordDecl>&Matcher"
+ "(Actual = Matcher<CXXRecordDecl|ObjCInterfaceDecl>&Matcher"
"<MemberExpr|UnresolvedMemberExpr|CXXDependentScopeMemberExpr>)",
Error->toString());
}
OpenPOWER on IntegriCloud