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.
I am still uncertain about the naming.
isSubclassOf seemed too generic as that could apply to C++ classes.
objcIsSubclassOf seemed unconventional as a matcher name.
isSubclassOfObjCInterface and isSubclassOfObjCClass seemed awkwardly lengthy.
Creating a new namespace clang::ast_matchers::objc seemed unprecedented.
I am happy to change the name if you think another name would be more appropriate.