[PATCH] D60543: [clang] Update isDerivedFrom to support Objective-C classes 🔍

Stephane Moore via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 28 20:24:15 PDT 2019


stephanemoore planned changes to this revision.
stephanemoore added a comment.

Thanks for the input! I will get started on making changes accordingly.



================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:2642-2649
+  if (const auto *InterfaceDecl = dyn_cast<ObjCInterfaceDecl>(&Node)) {
+    // Check if any of the superclasses of the class match.
+    for (const ObjCInterfaceDecl *SuperClass = InterfaceDecl->getSuperClass();
+         SuperClass != nullptr; SuperClass = SuperClass->getSuperClass()) {
+      if (Base.matches(*SuperClass, Finder, Builder))
+        return true;
+    }
----------------
aaron.ballman wrote:
> This should probably be done similar to how `classIsDerivedFrom()` works. For instance, there's some type alias matching logic that this does not replicate, but we probably want.
Upon first glance I had determined that the type aliasing logic in `classIsDerivedFrom()` was particular to C++. On second consideration, we will probably want to make sure that compatibility aliases are handled correctly for Objective-C. I will take a look into making sure that works as expected.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60543/new/

https://reviews.llvm.org/D60543





More information about the cfe-commits mailing list