[PATCH] D123304: [clang][extract-api] Emit "functionSignature" in SGF for ObjC methods.

Daniel Grumberg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 11 10:29:24 PDT 2022


dang marked an inline comment as done.
dang added inline comments.


================
Comment at: clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp:495
 
+    if (const auto *Method = dyn_cast<ObjCMethodRecord>(Member.get()))
+      serializeObject(*MemberRecord, "functionSignature",
----------------
zixuw wrote:
> dang wrote:
> > zixuw wrote:
> > > I'd prefer not to use `dyn_cast` as `MemberTy` here is a concrete type. So maybe a type trait `has_function_signature` and a `if constexpr`?
> > `if constexpr` is c++17 which we don't support yet? Anyway I added the type trait and implemented this a bit lower down the "stack" (in serializeAPIRecord) as there are multiple record types that have signatures. This is done using tag dispatch based on the trait.
> Hmm.. That's a bummer. Didn't realize that when I made the suggestion. I actually don't have that strong an opinion regarding the `dyn_cast`.
> What do you think? Do you think it's still worth going through all these to get the type trait working?
I think it is still worth it, so that we can emit function signatures in APIRecord as multiple types of records need them (and the list of records will keep growing). This could be a useful way of dealing with things like availability information as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123304



More information about the cfe-commits mailing list