Skip to content

Commit 3877eb8

Browse files
author
Paolo Tranquilli
committed
Swift: tentatively fix type mangling
1 parent 0141702 commit 3877eb8

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

swift/extractor/mangler/SwiftMangler.cpp

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,19 +197,30 @@ SwiftMangledName SwiftMangler::visitAnyFunctionType(const swift::AnyFunctionType
197197
auto ret = initMangled(type);
198198
for (const auto& param : type->getParams()) {
199199
ret << fetch(param.getPlainType());
200-
if (param.isInOut()) {
201-
ret << "_inout";
200+
auto flags = param.getParameterFlags();
201+
ret << "_" << getNameForParamSpecifier(flags.getOwnershipSpecifier());
202+
if (flags.isIsolated()) {
203+
ret << "_isolated";
202204
}
203-
if (param.isOwned()) {
204-
ret << "_owned";
205+
if (flags.isAutoClosure()) {
206+
ret << "_autoclosure";
205207
}
206-
if (param.isShared()) {
207-
ret << "_shared";
208+
if (flags.isNonEphemeral()) {
209+
ret << "_nonephermeral";
208210
}
209-
if (param.isIsolated()) {
211+
if (flags.isIsolated()) {
210212
ret << "_isolated";
211213
}
212-
if (param.isVariadic()) {
214+
if (flags.isSending()) {
215+
ret << "_sending";
216+
}
217+
if (flags.isCompileTimeConst()) {
218+
ret << "_compiletimeconst";
219+
}
220+
if (flags.isNoDerivative()) {
221+
ret << "_noderivative";
222+
}
223+
if (flags.isVariadic()) {
213224
ret << "...";
214225
}
215226
}
@@ -219,6 +230,9 @@ SwiftMangledName SwiftMangler::visitAnyFunctionType(const swift::AnyFunctionType
219230
}
220231
if (type->isThrowing()) {
221232
ret << "_throws";
233+
if (type->hasThrownError()) {
234+
ret << "(" << fetch(type->getThrownError()) << ")";
235+
}
222236
}
223237
if (type->isSendable()) {
224238
ret << "_sendable";

swift/third_party/load.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ load("//misc/bazel:lfs.bzl", "lfs_archive", "lfs_files")
66
_override = {
77
# these are used to test new artifacts. Must be empty before merging to main
88
"swift-prebuilt-macOS.tar.zst": "a016ed60ee1a534439ed4d55100ecf6b9fc739f629be20942345ac5156cb6296",
9-
"swift-prebuilt-Linux.tar.zst": "54240eb2da948207862ea8eb9bcbfe4447016534b9a8e6d8ee1af67db2a3e73f",
9+
"swift-prebuilt-Linux.tar.zst": "c45976d50670964132cef1dcf98bccd3fff809d33b2207a85cf3cfd07ec84528",
1010
"resource-dir-macOS.zip": "286e4403aa0a56641c2789e82036481535e336484f2c760bec0f42e3afe5dd87",
1111
"resource-dir-Linux.zip": "16a1760f152395377a580a994885e0877338279125834463a6a38f4006ad61ca",
1212
}

0 commit comments

Comments
 (0)