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:
Joe Groff
2023-03-02 20:41:40 -08:00
parent f3a6ce144c
commit 5345e982e9
16 changed files with 281 additions and 138 deletions

View File

@@ -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();