This is an archive of the discontinued LLVM Phabricator instance.

Add swift_async_context parameter attribute mapping to IR equivalent
ClosedPublic

Authored by t.p.northover on Jan 22 2021, 6:24 AM.

Details

Reviewers
aaron.ballman
Summary

This adds __attribute__((swift_async_context)) very much following the existing swift_context so that Swift's runtime implementation in C++ can generate functions that interact with Swift code properly. Hopefully nothing too controversial.

It depends on D95044 for the IR support.

Diff Detail

Event Timeline

t.p.northover created this revision.Jan 22 2021, 6:24 AM
t.p.northover requested review of this revision.Jan 22 2021, 6:24 AM
aaron.ballman accepted this revision.Jan 22 2021, 12:58 PM

LGTM with a documentation question and a testing request.

clang/include/clang/Basic/AttrDocs.td
4404

Should we specify whether pointer to members or ObjC object pointers are fine (given that those are both somewhat "odd" pointer types)? Function pointers?

(We may want to clarify this in the other docs in a follow-up if we think this is unclear.)

clang/test/Sema/attr-swiftcall.c
34

Can you also add tests that show the attribute doesn't accept any arguments and will error when written on the wrong subject (like a function rather than a parameter)?

This revision is now accepted and ready to land.Jan 22 2021, 12:58 PM
t.p.northover closed this revision.May 28 2021, 4:31 AM
t.p.northover marked an inline comment as done.

Thanks, committed as e94fada045fe with the extra tests.

clang/include/clang/Basic/AttrDocs.td
4404

I don't think either of those are banned, but it's kind of a "play silly games win silly prizes" situation.