Skip to content

[pull] swiftwasm from main #5411

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
merged 88 commits into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
54fe8a1
NFC: Fix warnings.
tshortli Apr 12, 2023
396f1dc
NFC: Rename `-unavailable-decl-optimization=complete` tests.
tshortli Apr 19, 2023
c735272
Frontend: Introduce `stub` mode for `-unavailable-decl-optimization`.
tshortli Apr 14, 2023
d1416dd
SILGen: Stub unavailable functions.
tshortli Apr 14, 2023
2f5b61e
SILOptimizer: Suppress unreachable code diagnostics for unavailable s…
tshortli Apr 14, 2023
8bc1112
SILGen: Stub unavailable constructors and destructors.
tshortli Apr 18, 2023
235922d
SILGen: Stub unavailable protocol witness thunks.
tshortli Apr 15, 2023
b1d2069
SILGen: Stub unavailable @objc interop functions and thunks.
tshortli Apr 18, 2023
798e29f
SILGen: Stub initializer functions for unavailable global vars.
tshortli Apr 19, 2023
65de2a5
SILGen: In unavailable stubs apply diagnostic func's back deployment …
tshortli Apr 19, 2023
8e58225
Utils: Fix default arch selection bug in cmpcodesize.py.
tshortli May 1, 2023
5f4fe49
Docs: Add missing manglings for `{get/store}EnumTagSinglePayload`.
tshortli May 1, 2023
12a122a
Tests: Fix unavailable_decl_optimization_stub tests on Windows.
tshortli May 3, 2023
bd4108c
Emit imported @objcImpl conformances
beccadax May 4, 2023
00e55cb
Don’t require @optional ObjC methods in @objcImpl
beccadax May 4, 2023
782b777
clang importer: don't trigger stack protection when accessing an impo…
eeckstein May 4, 2023
e93e4ba
[Macro] Handle error during initializing executable plugins
rintaro May 3, 2023
224674c
[move-only] Ensure that we treat captured escaping closure arguments …
gottesmm May 3, 2023
8682b17
[move-only] Remove a set of TODO from when we were not properly marki…
gottesmm May 4, 2023
444701c
[move-only] Remove a TODO that says we are erroring on the same varia…
gottesmm May 4, 2023
4cd7a3b
[move-only] Add additional test coverage to nonescaping closure test.
gottesmm May 4, 2023
7f0ef3d
[move-only] When assigning a var that escapes into a closure into ano…
gottesmm May 4, 2023
e181a4d
[Macros] Improve error handling for plugin errors
rintaro May 4, 2023
196c717
[interop] do not import function template with templated rvalue / per…
hyp May 4, 2023
ce04b84
Fix a performance issue when answering "is this tuple Copyable"?
kavon May 4, 2023
228078f
[interop][SwiftToCxx] remove extraneous semicolon when emitting 'prag…
hyp May 4, 2023
ba422f9
Sema: Fix incorrect assert in TypeCheckProtocol.cpp.
tshortli May 4, 2023
b0f5c39
[Driver] Derive '-external-plugin-path'
rintaro Apr 27, 2023
f4f6f7a
[interop][SwiftToCxx] avoid importing C++ stdlib in C++ section of ge…
hyp May 4, 2023
c140fe4
[CodeCompletion] Only show type annotations for macros that return no…
ahoppen May 5, 2023
14665f9
Merge pull request #65641 from beccadax/objc-impl-protocols
beccadax May 5, 2023
5beeca7
[CursorInfo] Prefer AST based results over solver based
bnbarham May 5, 2023
3d7df83
Merge pull request #65647 from eeckstein/fix-enum-stack-protection
eeckstein May 5, 2023
32e8987
consuming cannot be applied to nonescaping closures
kavon May 5, 2023
2e87972
docs/GettingStarted.md: support Linux in incremental build steps (#65…
MaxDesiatov May 5, 2023
c417741
[interop][SwiftToCxx] add swift::String overlay constructor for const…
hyp May 5, 2023
f984eda
Merge pull request #65473 from rintaro/driver-external-plugin-path-rd…
rintaro May 5, 2023
0a55811
Merge pull request #65630 from rintaro/macro-plugin-intiialize-rdar10…
rintaro May 5, 2023
b12537f
Merge pull request #65667 from tshortli/swiftinterface-missing-confor…
tshortli May 5, 2023
0366c42
Merge pull request #65557 from tshortli/unavailable-decl-optimization…
tshortli May 5, 2023
21745e5
[cxx-interop] Do not emit IR for C++20 requires expr
egorzhdan May 4, 2023
cfb76cc
[test] Allow customizing swift-ide-test invocations during tests. (#6…
drodriguez May 5, 2023
6d031cb
[IRGen] Respect optionality of unowned(unsafe) reference properties (…
drexin May 5, 2023
fc636ca
Merge pull request #65691 from kavon/consuming-nonescaping-closures
kavon May 5, 2023
9198a8a
Merge pull request #65694 from gottesmm/closurestuff
gottesmm May 5, 2023
f20a33d
Merge pull request #65637 from ahoppen/ahoppen/macro-type-annotation
ahoppen May 5, 2023
f667c86
Merge pull request #65673 from kavon/copyable-constraint-performance
kavon May 5, 2023
44bdd29
Revert "[AST] Allocate PlaceholderTypes in the correct arena"
hamishknight May 5, 2023
6ae5f1c
[test] Update test for placeholder revert
hamishknight May 5, 2023
9a496e8
Merge pull request #65652 from apple/egorzhdan/cxx-requires-irgen
egorzhdan May 5, 2023
f31d7cd
Merge pull request #65704 from hamishknight/revert-placeholder
swift-ci May 5, 2023
b54a5ba
Merge pull request #65662 from hyp/eng/semicolonnolon
hyp May 5, 2023
42bd9d0
Merge pull request #65680 from hyp/eng/cxx-warning-nomore-in-stdlib-f…
hyp May 5, 2023
175b64e
Merge pull request #65665 from hyp/eng/function-template-rvalue-ref
hyp May 5, 2023
1566ecc
[test] Take care of change out of deleted directories (#65664)
drodriguez May 5, 2023
7ac3ea0
make it illegal to use `_forget` in an initializer
kavon May 5, 2023
4943beb
emit error if `_forget` is used on a type with no deinit
kavon May 5, 2023
c6f551c
Fix discarding task-group availability
etcwilde May 5, 2023
f5fbee2
Fix indexing constructors with generic parameters (#65597)
keith May 5, 2023
01086bc
Merge pull request #65688 from bnbarham/swap-cursor-info-order
bnbarham May 5, 2023
aff3568
[interop][SwiftToCxx] emit unavailable type stubs for top level types…
hyp May 5, 2023
bf35e3f
[interop][SwiftToCxx] provide a clear unavailable message for protoco…
hyp May 5, 2023
c7836e3
[interop][SwiftToCxx] avoid emitting ambiguous C++ overloads
hyp May 6, 2023
ba74726
Tests: Update stability-stdlib-abi-without-asserts.
tshortli May 5, 2023
c7fedd4
[Executors] Fix delegation chain of Excecutor.enqueue for Job specifi…
ktoso May 6, 2023
578da49
disallow "non-trivial" stored properties when using forget
kavon May 6, 2023
64569a2
SIL: Teach about SILVerifier about TuplePackElementAddrInst and PackE…
slavapestov May 5, 2023
ee38655
SILOptimizer: Handle alloc_pack in StackNesting
slavapestov May 6, 2023
a76723f
SILGen: Remove some dead code
slavapestov May 4, 2023
ebb99e5
SILGen: Wrap captures of parameter packs inside tuples
slavapestov May 5, 2023
2cf01a1
[Sema] Fix issue 65330 Unhelpful error when missing contextually requ…
Apr 30, 2023
a04d273
Merge pull request #65732 from ktoso/wip-delegation-chain-fix-executors
swift-ci May 6, 2023
748315b
Merge pull request #65716 from tshortli/update-stability-stdlib-abi-w…
tshortli May 6, 2023
4010357
[interop][SwiftToCxx] fix foundation-type-not-exposed-by-default-to-c…
hyp May 6, 2023
74e87a9
[interop][SwiftToCxx] do not expose move-only Swift types
hyp May 6, 2023
5b26a23
Merge pull request #65735 from slavapestov/param-pack-captures
slavapestov May 6, 2023
42b3973
[cxx-interop] Do not mix up computed properties from different records
egorzhdan May 6, 2023
00b24c9
Fix SILDebugScopes for closures expanded from an expression macro.
adrian-prantl May 6, 2023
ace328a
Merge pull request #65683 from hyp/swift-string-from-literal
hyp May 6, 2023
c260792
Merge pull request #65690 from kavon/forget-usage-fixes
kavon May 6, 2023
ff52726
Merge pull request #65610 from jreference/65330-unhelpful-error-conte…
xedin May 6, 2023
8f66ab1
[AST] NFC: Silence a warning
hamishknight May 6, 2023
82ef9d3
[interop][SwiftToCxx] do not emit unavaialble stubs for internal/priv…
hyp May 6, 2023
6e878df
Merge pull request #65740 from apple/egorzhdan/cxx-computed-property
egorzhdan May 6, 2023
e1a23b8
Merge pull request #65745 from hamishknight/silence-warning
swift-ci May 6, 2023
a1dc63e
Merge pull request #65728 from hyp/eng/safe-overloads-and-unavailable…
hyp May 7, 2023
e0206da
Merge pull request #65741 from adrian-prantl/108618562
adrian-prantl May 7, 2023
08c4646
Merge pull request #65719 from etcwilde/ewilde/discarding-task-group-…
etcwilde May 8, 2023
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
Prev Previous commit
Next Next commit
[Driver] Derive '-external-plugin-path'
When the current toolchain is not a Xcode toolchain, derive
'-external-plugin-path' poinintng Xcode plugins paths, so we can use
plugins in Xcode.

rdar://108624128
  • Loading branch information
rintaro committed May 4, 2023
commit b0f5c3977f5ff606ea413620c7ccd50ffdddead7
95 changes: 95 additions & 0 deletions lib/Driver/DarwinToolChains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,61 @@ static bool findXcodeClangLibPath(const Twine &libName,
return true;
}

static bool findXcodeExecutableDir(llvm::SmallVectorImpl<char> &path) {
assert(path.empty());

auto xcrunPath = llvm::sys::findProgramByName("xcrun");
if (!xcrunPath.getError()) {
// Explicitly ask for the default toolchain so that we don't find a swiftc
// included with an open-source toolchain.
const char *args[] = {"-toolchain", "default", "-f", "swiftc", nullptr};
sys::TaskQueue queue;
queue.addTask(xcrunPath->c_str(), args, /*Env=*/llvm::None,
/*Context=*/nullptr,
/*SeparateErrors=*/true);
queue.execute(nullptr,
[&path](sys::ProcessId PID, int returnCode, StringRef output,
StringRef errors,
sys::TaskProcessInformation ProcInfo,
void *unused) -> sys::TaskFinishedResponse {
if (returnCode == 0) {
output = output.rtrim();
path.append(output.begin(), output.end());
llvm::sys::path::remove_filename(path); // 'swiftc'
}
return sys::TaskFinishedResponse::ContinueExecution;
});
}

return !path.empty();
}

static bool findCurrentSelectedXcodeDir(llvm::SmallVectorImpl<char> &path) {
assert(path.empty());

auto xcodeSelectPath = llvm::sys::findProgramByName("xcode-select");
if (!xcodeSelectPath.getError()) {
const char *args[] = {"-p", nullptr};
sys::TaskQueue queue;
queue.addTask(xcodeSelectPath->c_str(), args, /*Env=*/llvm::None,
/*Context=*/nullptr,
/*SeparateErrors=*/true);
queue.execute(nullptr,
[&path](sys::ProcessId PID, int returnCode, StringRef output,
StringRef errors,
sys::TaskProcessInformation ProcInfo,
void *unused) -> sys::TaskFinishedResponse {
if (returnCode == 0) {
output = output.rtrim();
path.append(output.begin(), output.end());
}
return sys::TaskFinishedResponse::ContinueExecution;
});
}

return !path.empty();
}

static void addVersionString(const ArgList &inputArgs, ArgStringList &arguments,
llvm::VersionTuple version) {
llvm::SmallString<8> buf;
Expand Down Expand Up @@ -601,6 +656,46 @@ void toolchains::Darwin::addCommonFrontendArgs(
llvm::opt::ArgStringList &arguments) const {
ToolChain::addCommonFrontendArgs(OI, output, inputArgs, arguments);

// Pass -external-plugin-path if the current toolchain is not a Xcode default
// toolchain.
{
// 'xcode-select -p'
SmallString<256> xcodeDir;
if (findCurrentSelectedXcodeDir(xcodeDir) &&
!StringRef(getDriver().getSwiftProgramPath()).starts_with(xcodeDir)) {

// 'xcrun -f swiftc'
SmallString<256> xcodeExecutableDir;
if (findXcodeExecutableDir(xcodeExecutableDir)) {
using namespace llvm::sys;

// '${toolchain}/usr/bin/swift-plugin-server'
SmallString<256> xcodePluginServerPath(xcodeExecutableDir);
path::append(xcodePluginServerPath, "swift-plugin-server");
if (fs::can_execute(xcodePluginServerPath)) {

// '${toolchain}/usr/lib/swift/host/plugins'
SmallString<256> xcodePluginPath(xcodeExecutableDir);
path::remove_filename(xcodePluginPath); // 'bin'
path::append(xcodePluginPath, "lib", "swift", "host", "plugins");

// '${toolchain}/usr/local/lib/swift/host/plugins'
SmallString<256> xcodeLocalPluginPath(xcodeExecutableDir);
path::remove_filename(xcodeLocalPluginPath); // 'bin'
path::append(xcodeLocalPluginPath, "local");
path::append(xcodeLocalPluginPath, "lib", "swift", "host", "plugins");

arguments.push_back("-external-plugin-path");
arguments.push_back(inputArgs.MakeArgString(xcodePluginPath + "#" +
xcodePluginServerPath));
arguments.push_back("-external-plugin-path");
arguments.push_back(inputArgs.MakeArgString(
xcodeLocalPluginPath + "#" + xcodePluginServerPath));
}
}
}
}

if (auto sdkVersion = getTargetSDKVersion(getTriple())) {
arguments.push_back("-target-sdk-version");
arguments.push_back(inputArgs.MakeArgString(sdkVersion->getAsString()));
Expand Down
2 changes: 0 additions & 2 deletions lib/Driver/ToolChains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,6 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI,
}

// Add plugin path options.
inputArgs.AddAllArgs(arguments, options::OPT_plugin_path);

{
SmallString<64> pluginPath;
auto programPath = getDriver().getSwiftProgramPath();
Expand Down
39 changes: 39 additions & 0 deletions test/Driver/external-plugin-path.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// REQUIRES: OS=macosx

// RUN: %empty-directory(%t)
// RUN: split-file %s %t

//# Prepare dummy Xcode.app
// RUN: mkdir -p %t/Xcode.app/Contents/Develoer
// RUN: mkdir -p %t/Xcode.app/Contents/Developer/usr/bin
// RUN: mkdir -p %t/Xcode.app/Contents/Developer/usr/lib/swift/host/plugins
// RUN: mkdir -p %t/Xcode.app/Contents/Developer/usr/local/lib/swift/host/plugins
// RUN: touch %t/Xcode.app/Contents/Developer/usr/bin/swiftc
// RUN: touch %t/Xcode.app/Contents/Developer/usr/bin/swift-plugin-server
// RUN: chmod +x %t/Xcode.app/Contents/Developer/usr/bin/swiftc
// RUN: chmod +x %t/Xcode.app/Contents/Developer/usr/bin/swift-plugin-server

//# Prepare dummy 'xcode-select' and 'xcrun'
// RUN: mkdir -p %t/usr/bin
// RUN: sed 's;TMPDIR;%t;' %t/xcode-select > %t/usr/bin/xcode-select
// RUN: sed 's;TMPDIR;%t;' %t/xcrun > %t/usr/bin/xcrun
// RUN: chmod +x %t/usr/bin/xcode-select
// RUN: chmod +x %t/usr/bin/xcrun

// RUN: env PATH=%t/usr/bin %swift_driver_plain -### %t/test.swift | %FileCheck %s

// CHECK: -plugin-path BUILD_DIR/lib/swift/host/plugins
// CHECK-SAME: -plugin-path BUILD_DIR/local/lib/swift/host/plugins
// CHECK-SAME: -external-plugin-path BUILD_DIR/{{[^#]+}}/Xcode.app/Contents/Developer/usr/lib/swift/host/plugins#BUILD_DIR/{{[^#]+}}/Xcode.app/Contents/Developer/usr/bin/swift-plugin-server
// CHECK-SAME: -external-plugin-path BUILD_DIR/{{[^#]+}}/Xcode.app/Contents/Developer/usr/local/lib/swift/host/plugins#BUILD_DIR/{{[^#]+}}/Xcode.app/Contents/Developer/usr/bin/swift-plugin-server

//--- xcrun
#!/bin/sh
echo TMPDIR/Xcode.app/Contents/Developer/usr/bin/swiftc

//--- xcode-select
#!/bin/sh
echo TMPDIR/Xcode.app/Contents/Developer

//--- test.swift
print(1)