Skip to content

Instantly share code, notes, and snippets.

View airspeedswift's full-sized avatar

Ben Cohen airspeedswift

View GitHub Profile
@DougGregor
DougGregor / swift_cxx_interop_first_steps.md
Created July 18, 2019 17:32
First steps for Swift/C++ interoperability

First steps for Swift/C++ Interoperability

Just a quick brain dump of "first steps" to move Swift/C++ interoperability forward. While there are many big and interesting design questions for a good interoperability story, there are also a large number of implementation tasks that can proceed independently of those design discussions (and often in parallel). This list focuses on those implementation tasks:

  1. (DONE) Add a flag -enable-cxx-interop to the frontend, and have it enable (Objective-)C++ mode in the Clang importer.
  2. Add a lit configuration flag to enable -enable-cxx-interop for the full Swift testsuite and fix all of the issues that prevent (Objective-)C code from being imported correctly when it's compiled as C++. The testsuite will likely need a lot of extern "C" annotations throughout it's headers---those fixes can be committed to the testsuite behind appropriate #ifdefs.
  3. Import C++ namespaces as Swift enums that have no cases (so-called "uninhabited enums") so the C++ lexical struct