Let the frontend options handle multiple output files.

This will be needed for split-llvm code generation.
If multiple -o options are specified and only a single output file is needed
(currently always), the last one wins. This is NFC.



Swift SVN r25884
This commit is contained in:
Erik Eckstein
2015-03-09 16:24:52 +00:00
parent 8531045449
commit 460eea3b95
8 changed files with 66 additions and 48 deletions

View File

@@ -67,16 +67,17 @@ bool FrontendOptions::actionIsImmediate() const {
void FrontendOptions::forAllOutputPaths(
std::function<void(const std::string &)> fn) const {
if (RequestedAction != FrontendOptions::EmitModuleOnly) {
for (const std::string &OutputFileName : OutputFilenames) {
fn(OutputFileName);
}
}
const std::string *outputs[] = {
&OutputFilename,
&ModuleOutputPath,
&ModuleDocOutputPath,
&ObjCHeaderOutputPath
};
for (const std::string *next : outputs) {
if (RequestedAction == FrontendOptions::EmitModuleOnly &&
next == &OutputFilename)
continue;
if (!next->empty())
fn(*next);
}