Driver uses its path to derive the plugin paths (i.e.
'lib/swift/host/plugins' et al.) Previously it was a constant string
'swiftc' that caused SourceKit failed to find dylib plugins in the
toolchain. Since 'SwiftLangSupport' knows the swift-frontend path,
use it, but replacing the filename with 'swiftc', to derive the plugin
paths.
rdar://107849796
We've seen bad file descriptor errors in certain build environments (rdar://73157185) and retrying
opening those files seems to be a walkaround. In this change, we allow the
compiler to retry expanding reponse files in argument lists.
rdar://73892564
When producing frontend arguments for sourcekitd, force the output mode
to -typecheck so that we do not create any temporary output files in the
driver. Previously, any sourcekitd operation that created a compiler
invocation would create 0-sized .o file inside $TMPDIR that would never
be cleaned up.
The new swift-driver project handles temporaries much better as
VirtualPath, and should not need this approach.
rdar://62366123
But not even that much uglier; at all three call sites this will save
an allocation, and for the most important one (SourceKit) we can now
avoid creating a temporary CompilerInvocation just to copy into a
longer-lived one.
With this change, Driver no longer depends on Frontend, which means...
well, slightly faster builds of the compiler itself, but not much
else.
Added a new API, swift::driver::createCompilerInvocation. This takes an array
of driver arguments, constructs a Driver and a Compilation, and then uses the
Compilation's frontend arguments to create a CompilerInvocation.
This works by forcing Driver to create a Compilation which contains a single
compile command. (It achieves this by passing
"-force-single-frontend-invocation" after all other arguments.) This approach
roughly matches Clang's clang::createInvocationFromCommandLine.
As implied by the namespacing, this lives in swiftDriver. As a result,
swiftDriver now depends on swiftFrontend.
In support of this, added a couple of driver diagnostics for exceptional error
cases (where Driver produced something other than a single Command, or if that
Command is not a frontend command).
This fixes <rdar://problem/16125395>.
Swift SVN r20972