mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Driver] Allow passing all source files in a filelist.
Generate frontend commands with -filelist in them. This isn't actually implemented yet, but we can start testing at this point. Part 1 of https://bugs.swift.org/browse/SR-280.
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Driver/ToolChain.h"
|
||||
|
||||
#include "swift/Driver/Compilation.h"
|
||||
#include "swift/Driver/Driver.h"
|
||||
#include "swift/Driver/Job.h"
|
||||
#include "llvm/Option/ArgList.h"
|
||||
@@ -33,16 +33,29 @@ using namespace llvm::opt;
|
||||
|
||||
const char * const ToolChain::SWIFT_EXECUTABLE_NAME;
|
||||
|
||||
ToolChain::JobContext::JobContext(const Compilation &C,
|
||||
ArrayRef<const Job *> Inputs,
|
||||
ArrayRef<const Action *> InputActions,
|
||||
const CommandOutput &Output,
|
||||
const OutputInfo &OI)
|
||||
: C(C), Inputs(Inputs), InputActions(InputActions), Output(Output),
|
||||
OI(OI), Args(C.getArgs()) {}
|
||||
|
||||
ArrayRef<InputPair> ToolChain::JobContext::getTopLevelInputFiles() const {
|
||||
return C.getInputFiles();
|
||||
}
|
||||
const std::string &ToolChain::JobContext::getAllSourcesPath() const {
|
||||
return C.getAllSourcesPath();
|
||||
}
|
||||
|
||||
std::unique_ptr<Job>
|
||||
ToolChain::constructJob(const JobAction &JA,
|
||||
const Compilation &C,
|
||||
SmallVectorImpl<const Job *> &&inputs,
|
||||
std::unique_ptr<CommandOutput> output,
|
||||
const ActionList &inputActions,
|
||||
const llvm::opt::ArgList &args,
|
||||
ArrayRef<InputPair> topLevelInputFiles,
|
||||
std::unique_ptr<CommandOutput> output,
|
||||
const OutputInfo &OI) const {
|
||||
JobContext context{inputs, *output, inputActions, args, topLevelInputFiles,
|
||||
OI};
|
||||
JobContext context{C, inputs, inputActions, *output, OI};
|
||||
|
||||
auto invocationInfo = [&]() -> InvocationInfo {
|
||||
switch (JA.getKind()) {
|
||||
@@ -71,12 +84,12 @@ ToolChain::constructJob(const JobAction &JA,
|
||||
std::string relativePath =
|
||||
findProgramRelativeToSwift(invocationInfo.ExecutableName);
|
||||
if (!relativePath.empty()) {
|
||||
executablePath = args.MakeArgString(relativePath);
|
||||
executablePath = C.getArgs().MakeArgString(relativePath);
|
||||
} else {
|
||||
auto systemPath =
|
||||
llvm::sys::findProgramByName(invocationInfo.ExecutableName);
|
||||
if (systemPath) {
|
||||
executablePath = args.MakeArgString(systemPath.get());
|
||||
executablePath = C.getArgs().MakeArgString(systemPath.get());
|
||||
} else {
|
||||
// For debugging purposes.
|
||||
executablePath = invocationInfo.ExecutableName;
|
||||
|
||||
Reference in New Issue
Block a user