This is an archive of the discontinued LLVM Phabricator instance.

[clang][extract-api] Emit "functionSignature" in SGF for ObjC methods.
ClosedPublic

Authored by dang on Apr 7 2022, 6:01 AM.

Diff Detail

Event Timeline

dang created this revision.Apr 7 2022, 6:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2022, 6:01 AM
dang requested review of this revision.Apr 7 2022, 6:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2022, 6:01 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
zixuw added inline comments.Apr 7 2022, 11:40 AM
clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
512

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?

dang updated this revision to Diff 421932.Apr 11 2022, 8:02 AM

Address code review feedback.

Introduce has_function_signature type trait to distinguish records that have a
function signatures.

dang added inline comments.Apr 11 2022, 8:09 AM
clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
512

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.

zixuw added inline comments.Apr 11 2022, 10:00 AM
clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
512

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?

dang marked an inline comment as done.Apr 11 2022, 10:29 AM
dang added inline comments.
clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
512

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.

zixuw accepted this revision.Apr 11 2022, 10:41 AM

LGTM!

This revision is now accepted and ready to land.Apr 11 2022, 10:41 AM
This revision was landed with ongoing or failed builds.Apr 11 2022, 11:07 AM
This revision was automatically updated to reflect the committed changes.
dang marked an inline comment as done.