Skip to content

Commit

Permalink
Swift: tentatively fix type mangling
Browse files Browse the repository at this point in the history
  • Loading branch information
Paolo Tranquilli committed Oct 30, 2024
1 parent 0141702 commit 3877eb8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
30 changes: 22 additions & 8 deletions swift/extractor/mangler/SwiftMangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,30 @@ SwiftMangledName SwiftMangler::visitAnyFunctionType(const swift::AnyFunctionType
auto ret = initMangled(type);
for (const auto& param : type->getParams()) {
ret << fetch(param.getPlainType());
if (param.isInOut()) {
ret << "_inout";
auto flags = param.getParameterFlags();
ret << "_" << getNameForParamSpecifier(flags.getOwnershipSpecifier());
if (flags.isIsolated()) {
ret << "_isolated";
}
if (param.isOwned()) {
ret << "_owned";
if (flags.isAutoClosure()) {
ret << "_autoclosure";
}
if (param.isShared()) {
ret << "_shared";
if (flags.isNonEphemeral()) {
ret << "_nonephermeral";
}
if (param.isIsolated()) {
if (flags.isIsolated()) {
ret << "_isolated";
}
if (param.isVariadic()) {
if (flags.isSending()) {
ret << "_sending";
}
if (flags.isCompileTimeConst()) {
ret << "_compiletimeconst";
}
if (flags.isNoDerivative()) {
ret << "_noderivative";
}
if (flags.isVariadic()) {
ret << "...";
}
}
Expand All @@ -219,6 +230,9 @@ SwiftMangledName SwiftMangler::visitAnyFunctionType(const swift::AnyFunctionType
}
if (type->isThrowing()) {
ret << "_throws";
if (type->hasThrownError()) {
ret << "(" << fetch(type->getThrownError()) << ")";
}
}
if (type->isSendable()) {
ret << "_sendable";
Expand Down
2 changes: 1 addition & 1 deletion swift/third_party/load.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ load("//misc/bazel:lfs.bzl", "lfs_archive", "lfs_files")
_override = {
# these are used to test new artifacts. Must be empty before merging to main
"swift-prebuilt-macOS.tar.zst": "a016ed60ee1a534439ed4d55100ecf6b9fc739f629be20942345ac5156cb6296",
"swift-prebuilt-Linux.tar.zst": "54240eb2da948207862ea8eb9bcbfe4447016534b9a8e6d8ee1af67db2a3e73f",
"swift-prebuilt-Linux.tar.zst": "c45976d50670964132cef1dcf98bccd3fff809d33b2207a85cf3cfd07ec84528",
"resource-dir-macOS.zip": "286e4403aa0a56641c2789e82036481535e336484f2c760bec0f42e3afe5dd87",
"resource-dir-Linux.zip": "16a1760f152395377a580a994885e0877338279125834463a6a38f4006ad61ca",
}
Expand Down

0 comments on commit 3877eb8

Please sign in to comment.