mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Only mangle borrowing/consuming when they would change ABI.
`__shared` and `__owned` would always get mangled, even when they don't have any effect on ABI, making it unnecessarily ABI-breaking to apply them to existing API to make calling conventions explicit. Avoid this issue by only mangling them in cases where they change the ABI from the default.
This commit is contained in:
@@ -5724,23 +5724,6 @@ getActualReferenceOwnership(serialization::ReferenceOwnership raw) {
|
||||
return None;
|
||||
}
|
||||
|
||||
/// Translate from the serialization ValueOwnership enumerators, which are
|
||||
/// guaranteed to be stable, to the AST ones.
|
||||
static Optional<swift::ValueOwnership>
|
||||
getActualValueOwnership(serialization::ValueOwnership raw) {
|
||||
switch (raw) {
|
||||
#define CASE(ID) \
|
||||
case serialization::ValueOwnership::ID: \
|
||||
return swift::ValueOwnership::ID;
|
||||
CASE(Default)
|
||||
CASE(InOut)
|
||||
CASE(Shared)
|
||||
CASE(Owned)
|
||||
#undef CASE
|
||||
}
|
||||
return None;
|
||||
}
|
||||
|
||||
/// Translate from the serialization ParameterConvention enumerators,
|
||||
/// which are guaranteed to be stable, to the AST ones.
|
||||
static
|
||||
@@ -6114,8 +6097,8 @@ detail::function_deserializer::deserialize(ModuleFile &MF,
|
||||
isNonEphemeral, rawOwnership, isIsolated, isNoDerivative,
|
||||
isCompileTimeConst);
|
||||
|
||||
auto ownership =
|
||||
getActualValueOwnership((serialization::ValueOwnership)rawOwnership);
|
||||
auto ownership = getActualParamDeclSpecifier(
|
||||
(serialization::ParamDeclSpecifier)rawOwnership);
|
||||
if (!ownership)
|
||||
return MF.diagnoseFatal();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user