• Drew's avatar
    Add `umbrella-header` to specify umbrella headers · 089ebe8b
    Drew authored
    This is essentially the same as a "bridging" header, except without any
    ObjC (straight C).  Upstream says it "can't be done"; let's see if Linux
    CI likes this implementation.  Take *that*, anonymous compiler engineers.
    My motivation for this patch is essentially as a workaround for SR-655.
    That is to say, I want to call some arbitrary C code, but due to that
    bug, I can't hide my C code behind a module / modulemap.
    Instead what I can do is just `#include <whatever>` in my umbrella
    header, and then the C imports are available to Swift.
    Internally, we emit a modulemap based on the umbrella header and then
    inject some compile flags (notably, `-import-underlying-module`) to make
    it load.  This is the design I reverse-engineered from Xcode.  That
    notwithstanding, it seems to be based entirely on public APIs and I
    guess we'll find out if it works on Linux.
    While my motivation is based on C imports, umbrella headers may be
    useful wherever Swift projects are sold.  There are multiple features
    that get unlocked here, including access to the C preprocessor.
atllbuild.swift 16.6 KB