This is an archive of the discontinued LLVM Phabricator instance.

[clang] Add support for attribute 'swift_async'
ClosedPublic

Authored by erik.pilkington on Dec 6 2020, 6:38 PM.

Details

Summary

This attributes specifies how (or if) a given function or method will be imported into a swift async method. You can read more about swift async here: https://github.com/DougGregor/swift-evolution/blob/concurrency-objc/proposals/NNNN-concurrency-objc.md. rdar://70111252

Thanks for taking a look!

Diff Detail

Event Timeline

erik.pilkington created this revision.Dec 6 2020, 6:38 PM
erik.pilkington requested review of this revision.Dec 6 2020, 6:38 PM
doug.gregor accepted this revision.Dec 6 2020, 11:22 PM

This looks good. I went ahead and tested it as part of adoption in Swift's Clang importer, over at https://github.com/apple/swift/pull/34985

This revision is now accepted and ready to land.Dec 6 2020, 11:22 PM
aaron.ballman accepted this revision.Dec 7 2020, 6:33 AM

LGTM aside from a minor nit.

clang/include/clang/Basic/AttrDocs.td
4367

for swift_async because -> for the swift_async attribute because

clang/lib/Sema/SemaDeclAttr.cpp
6046

FWIW, we usually use warn_attribute_type_not_supported for this diagnostic rather than coming up with a unique diagnostic per enumeration. (This sort of feels like something we should use tablegen to handle anyway.)

I don't insist on a change as your diagnostic is slightly better than what we usually use, but if you feel like making the change for consistency with other attribute behavior, that's fine by me as well.

This revision was automatically updated to reflect the committed changes.
erik.pilkington marked 2 inline comments as done.
Herald added a project: Restricted Project. · View Herald TranscriptDec 7 2020, 2:20 PM