mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SourceKit] Pass 'swiftc' path to Driver when creating frontend args
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
This commit is contained in:
@@ -896,7 +896,8 @@ std::shared_ptr<sma::Module> createSMAModel(ModuleDecl *M) {
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
int swift::doGenerateModuleAPIDescription(StringRef MainExecutablePath,
|
||||
int swift::doGenerateModuleAPIDescription(StringRef DriverPath,
|
||||
StringRef MainExecutablePath,
|
||||
ArrayRef<std::string> Args) {
|
||||
std::vector<const char *> CStringArgs;
|
||||
for (auto &S : Args) {
|
||||
@@ -910,9 +911,10 @@ int swift::doGenerateModuleAPIDescription(StringRef MainExecutablePath,
|
||||
|
||||
CompilerInvocation Invocation;
|
||||
bool HadError = driver::getSingleFrontendInvocationFromDriverArguments(
|
||||
CStringArgs, Diags, [&](ArrayRef<const char *> FrontendArgs) {
|
||||
return Invocation.parseArgs(FrontendArgs, Diags);
|
||||
});
|
||||
MainExecutablePath, CStringArgs, Diags,
|
||||
[&](ArrayRef<const char *> FrontendArgs) {
|
||||
return Invocation.parseArgs(FrontendArgs, Diags);
|
||||
});
|
||||
|
||||
if (HadError) {
|
||||
llvm::errs() << "error: unable to create a CompilerInvocation\n";
|
||||
@@ -941,4 +943,3 @@ int swift::doGenerateModuleAPIDescription(StringRef MainExecutablePath,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user