mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +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:
@@ -4785,18 +4785,6 @@ getRawStableReferenceOwnership(swift::ReferenceOwnership ownership) {
|
||||
}
|
||||
llvm_unreachable("bad ownership kind");
|
||||
}
|
||||
/// Translate from the AST ownership enum to the Serialization enum
|
||||
/// values, which are guaranteed to be stable.
|
||||
static uint8_t getRawStableValueOwnership(swift::ValueOwnership ownership) {
|
||||
switch (ownership) {
|
||||
SIMPLE_CASE(ValueOwnership, Default)
|
||||
SIMPLE_CASE(ValueOwnership, InOut)
|
||||
SIMPLE_CASE(ValueOwnership, Shared)
|
||||
SIMPLE_CASE(ValueOwnership, Owned)
|
||||
}
|
||||
llvm_unreachable("bad ownership kind");
|
||||
}
|
||||
|
||||
/// Translate from the AST ParameterConvention enum to the
|
||||
/// Serialization enum values, which are guaranteed to be stable.
|
||||
static uint8_t getRawStableParameterConvention(swift::ParameterConvention pc) {
|
||||
@@ -5153,7 +5141,7 @@ public:
|
||||
for (auto ¶m : fnTy->getParams()) {
|
||||
auto paramFlags = param.getParameterFlags();
|
||||
auto rawOwnership =
|
||||
getRawStableValueOwnership(paramFlags.getValueOwnership());
|
||||
getRawStableParamDeclSpecifier(paramFlags.getOwnershipSpecifier());
|
||||
FunctionParamLayout::emitRecord(
|
||||
S.Out, S.ScratchRecord, abbrCode,
|
||||
S.addDeclBaseNameRef(param.getLabel()),
|
||||
|
||||
Reference in New Issue
Block a user