Changes to code generation to support non-objc targets

Swift SVN r23118
This commit is contained in:
Graham Batty
2014-11-05 18:05:55 +00:00
parent ec4accfda8
commit 63a429f16e
12 changed files with 146 additions and 51 deletions

View File

@@ -91,7 +91,7 @@ static void updateTargetConfigurationOptions(LangOptions &LangOpts,
}
// Set the "runtime" target configuration.
if (triple.isOSDarwin())
if (LangOpts.EnableObjCInterop)
LangOpts.addTargetConfigOption("_runtime", "_ObjC");
else
LangOpts.addTargetConfigOption("_runtime", "_Native");
@@ -629,6 +629,12 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.DebuggerSupport |= Args.hasArg(OPT_debugger_support);
Opts.Playground |= Args.hasArg(OPT_playground);
if (auto A = Args.getLastArg(OPT_enable_objc_interop,
OPT_disable_objc_interop)) {
Opts.EnableObjCInterop
= A->getOption().matches(OPT_enable_objc_interop);
}
if (auto A = Args.getLastArg(OPT_enable_objc_attr_requires_foundation_module,
OPT_disable_objc_attr_requires_foundation_module)) {
Opts.EnableObjCAttrRequiresFoundation
@@ -941,6 +947,12 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
if (const Arg *A = Args.getLastArg(OPT_target))
Opts.Triple = llvm::Triple::normalize(A->getValue());
if (auto A = Args.getLastArg(OPT_enable_objc_interop,
OPT_disable_objc_interop)) {
Opts.EnableObjCInterop
= A->getOption().matches(OPT_enable_objc_interop);
}
// TODO: investigate whether these should be removed, in favor of definitions
// in other classes.
if (FrontendOpts.PrimaryInput && FrontendOpts.PrimaryInput->isFilename()) {