Skip to content

Commit 5846a7f

Browse files
authored
Merge pull request #16549 from benlangmuir/sourcekit-resource-dir-42-04-30
[4.2 2018-04-30] [sourcekit] Pass -resource-dir when parsing driver arguments
2 parents 94be684 + da1a43c commit 5846a7f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

test/SourceKit/Misc/ignored-flags.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ s.
1515
// RUN: %sourcekitd-test -req=complete -pos=2:3 %s -- -use-ld=blah %s | %FileCheck %s
1616
// RUN: %sourcekitd-test -req=complete -pos=2:3 %s -- -incremental %s | %FileCheck %s
1717
// RUN: %sourcekitd-test -req=complete -pos=2:3 %s -- -driver-time-compilation %s | %FileCheck %s
18+
// RUN: %sourcekitd-test -req=complete -pos=2:3 %s -- -sanitize=address,fuzzer -sanitize-coverage=func %s | %FileCheck %s
1819

1920

2021
// Mode flags

tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,10 +414,14 @@ resolveSymbolicLinksInInputs(FrontendInputsAndOutputs &inputsAndOutputs,
414414
}
415415

416416
bool SwiftASTManager::initCompilerInvocation(CompilerInvocation &Invocation,
417-
ArrayRef<const char *> Args,
417+
ArrayRef<const char *> OrigArgs,
418418
DiagnosticEngine &Diags,
419419
StringRef UnresolvedPrimaryFile,
420420
std::string &Error) {
421+
SmallVector<const char *, 16> Args(OrigArgs.begin(), OrigArgs.end());
422+
Args.push_back("-resource-dir");
423+
Args.push_back(Impl.RuntimeResourcePath.c_str());
424+
421425
if (auto driverInvocation = driver::createCompilerInvocation(Args, Diags)) {
422426
Invocation = *driverInvocation;
423427
} else {
@@ -426,8 +430,6 @@ bool SwiftASTManager::initCompilerInvocation(CompilerInvocation &Invocation,
426430
return true;
427431
}
428432

429-
Invocation.setRuntimeResourcePath(Impl.RuntimeResourcePath);
430-
431433
Invocation.getFrontendOptions().InputsAndOutputs =
432434
resolveSymbolicLinksInInputs(
433435
Invocation.getFrontendOptions().InputsAndOutputs,

0 commit comments

Comments
 (0)