Skip to content

[4.2 2018-04-30] [sourcekit] Pass -resource-dir when parsing driver arguments #16549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
1 change: 1 addition & 0 deletions test/SourceKit/Misc/ignored-flags.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ s.
// RUN: %sourcekitd-test -req=complete -pos=2:3 %s -- -use-ld=blah %s | %FileCheck %s
// RUN: %sourcekitd-test -req=complete -pos=2:3 %s -- -incremental %s | %FileCheck %s
// RUN: %sourcekitd-test -req=complete -pos=2:3 %s -- -driver-time-compilation %s | %FileCheck %s
// RUN: %sourcekitd-test -req=complete -pos=2:3 %s -- -sanitize=address,fuzzer -sanitize-coverage=func %s | %FileCheck %s


// Mode flags
Expand Down
8 changes: 5 additions & 3 deletions tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,14 @@ resolveSymbolicLinksInInputs(FrontendInputsAndOutputs &inputsAndOutputs,
}

bool SwiftASTManager::initCompilerInvocation(CompilerInvocation &Invocation,
ArrayRef<const char *> Args,
ArrayRef<const char *> OrigArgs,
DiagnosticEngine &Diags,
StringRef UnresolvedPrimaryFile,
std::string &Error) {
SmallVector<const char *, 16> Args(OrigArgs.begin(), OrigArgs.end());
Args.push_back("-resource-dir");
Args.push_back(Impl.RuntimeResourcePath.c_str());

if (auto driverInvocation = driver::createCompilerInvocation(Args, Diags)) {
Invocation = *driverInvocation;
} else {
Expand All @@ -426,8 +430,6 @@ bool SwiftASTManager::initCompilerInvocation(CompilerInvocation &Invocation,
return true;
}

Invocation.setRuntimeResourcePath(Impl.RuntimeResourcePath);

Invocation.getFrontendOptions().InputsAndOutputs =
resolveSymbolicLinksInInputs(
Invocation.getFrontendOptions().InputsAndOutputs,
Expand Down