Add -import-objc-header option, and wire up the basic infrastructure.

THIS IS NOT READY FOR USE YET.

The new plan for mixed-source non-framework targets is that the Swift
compiler will import an Objective-C header directly, and treat the decls
and imports in that header as explicitly visible to the entire target.
This means users don't have to modularize their headers before bringing
them into Swift.

This commit adds the option and introduces the "imported headers" module
as an implicit import for the source files being compiled. It also directs
the Clang importer to process the given header (using #import, so that it
won't somehow get included twice) and watches for any module imports that
occur as a result of reading that header.

Still to come: import of decls within the header (not within any module),
and proper serialization of cross-references to the header and its imports.

Part of <rdar://problem/16702101>

Swift SVN r17218
This commit is contained in:
Jordan Rose
2014-05-02 00:55:31 +00:00
parent a5b83f0ab4
commit cf77de720a
12 changed files with 200 additions and 70 deletions

View File

@@ -496,6 +496,9 @@ static bool ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
Opts.LLVMArgs = Args.getAllArgValues(OPT_Xllvm);
Opts.ImportUnderlyingModule = Args.hasArg(OPT_import_underlying_module);
if (const Arg *A = Args.getLastArg(OPT_import_objc_header))
Opts.ImplicitObjCHeaderPath = A->getValue();
return false;
}