[driver] Use the OutputMode to determine the value to pass with -module-name.

Swift SVN r12499
This commit is contained in:
Connor Wakamo
2014-01-17 19:39:24 +00:00
parent 64a18140a1
commit f99d60906c

View File

@@ -101,13 +101,8 @@ Job *Swift::constructJob(const JobAction &JA, std::unique_ptr<JobList> Inputs,
}
}
if (Args.hasArg(options::OPT_module_name)) {
Args.AddLastArg(Arguments, options::OPT_module_name);
} else if (const Arg *A = Args.getLastArgNoClaim(options::OPT_o)) {
Arguments.push_back("-module-name");
StringRef InferredModuleName = llvm::sys::path::stem(A->getValue());
Arguments.push_back(Args.MakeArgString(InferredModuleName));
}
Arguments.push_back("-module-name");
Arguments.push_back(Args.MakeArgString(OM.ModuleName));
Args.AddLastArg(Arguments, options::OPT_g);
@@ -170,6 +165,9 @@ Job *MergeModule::constructJob(const JobAction &JA,
// serialized ASTs.
Arguments.push_back("-parse-as-library");
Arguments.push_back("-module-name");
Arguments.push_back(Args.MakeArgString(OM.ModuleName));
// We just want to emit a module, so pa
Arguments.push_back("-emit-module");