Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions include/swift/Driver/Driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ class Driver {
/// Indicates whether the driver should check that the input files exist.
bool CheckInputFilesExist = true;

/// Indicates that this driver never actually executes any commands but is
/// just set up to retrieve the swift-frontend invocation that would be
/// executed during compilation.
bool IsDummyDriverForFrontendInvocation = false;

public:
Driver(StringRef DriverExecutable, StringRef Name,
ArrayRef<const char *> Args, DiagnosticEngine &Diags);
Expand All @@ -226,6 +231,14 @@ class Driver {

void setCheckInputFilesExist(bool Value) { CheckInputFilesExist = Value; }

bool isDummyDriverForFrontendInvocation() const {
return IsDummyDriverForFrontendInvocation;
}

void setIsDummyDriverForFrontendInvocation(bool Value) {
IsDummyDriverForFrontendInvocation = Value;
}

/// Creates an appropriate ToolChain for a given driver, given the target
/// specified in \p Args (or the default target). Sets the value of \c
/// DefaultTargetTriple from \p Args as a side effect.
Expand Down
12 changes: 9 additions & 3 deletions lib/Driver/DarwinToolChains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,9 +901,15 @@ void
toolchains::Darwin::validateArguments(DiagnosticEngine &diags,
const llvm::opt::ArgList &args,
StringRef defaultTarget) const {
// Validating arclite library path when link-objc-runtime.
validateLinkObjcRuntimeARCLiteLib(*this, diags, args);

if (!getDriver().isDummyDriverForFrontendInvocation()) {
// Validating arclite library path when link-objc-runtime.
// If the driver is just set up to retrieve the swift-frontend invocation,
// we don't care about link-time, so we can skip this step, which may be
// expensive since it might call to `xcrun` to find `clang` and `arclite`
// relative to `clang`.
validateLinkObjcRuntimeARCLiteLib(*this, diags, args);
}

// Validating apple platforms deployment targets.
validateDeploymentTarget(*this, diags, args);
validateTargetVariant(*this, diags, args, defaultTarget);
Expand Down
2 changes: 2 additions & 0 deletions lib/Driver/FrontendUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ bool swift::driver::getSingleFrontendInvocationFromDriverArguments(
// CompilerInvocation may wish to remap inputs to source buffers.
TheDriver.setCheckInputFilesExist(false);

TheDriver.setIsDummyDriverForFrontendInvocation(true);

std::unique_ptr<llvm::opt::InputArgList> ArgList =
TheDriver.parseArgStrings(ArrayRef<const char *>(Args).slice(1));
if (Diags.hadAnyError())
Expand Down