[PATCH] D129398: [ASTMatchers] Add a new matcher for callee declarations of Obj-C message expressions

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 13 03:58:29 PDT 2022


aaron.ballman added a comment.

Thank you, this is looking really promising!

Can you also add a test to `unittests/ASTMatchers/Dynamic/RegistryTest.cpp` to the `TEST_F(RegistryTest, OverloadedMatchers)` test which tests the behavior of `callee()` to make sure it works from dynamic matchers? If that test fails, I think you may need to update `lib/ASTMatchers/Dynamic/Registry.cpp` to add a `REGISTER_OVERLOADED_3` that is used by both `callee` and `equals`.



================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:3871
+    // supported return types.
+    const auto *MsgNode = dyn_cast<ObjCMessageExpr>(&Node);
+    const Decl *DeclNode = MsgNode->getMethodDecl();
----------------
This way you get an assert if someone adds another type and forgets to update the rest of the body.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129398



More information about the cfe-commits mailing list