Future-proof the mangling of invertible protocols

Invertible protocols are currently always mangled with `Ri`, followed by
a single letter for each invertible protocol (e.g., `c` and `e` for
`Copyable` and `Escapable`, respectively), followed by the generic
parameter index. However, this requires that we extend the mangling
for any future invertible protocols, which mean they won't be
backward compatible.

Replace this mangling with one that mangles the bit # for the
invertible protocol, e.g., `Ri_` (followed by the generic parameter
index) is bit 0, which is `Copyable`. `Ri0_` (then generic parameter
index) is bit 1, which is `Escapable`. This allows us to round-trip
through mangled names for any invertible protocol, without any
knowledge of what the invertible protocol is, providing forward
compatibility. The same forward compatibility is present in all
metadata and the runtime, allowing us to add more invertible
protocols in the future without updating any of them, and also
allowing backward compatibility.

Only the demangling to human-readable strings maps the bit numbers
back to their names, and there's a fallback printing with just the bit
number when appropriate.

Also generalize the mangling a bit to allow for mangling of invertible
requirements on associated types, e.g., `S.Sequence: ~Copyable`. This
is currently unsupported by the compiler or runtime, but that may
change, and it was easy enough to finish off the mangling work for it.
This commit is contained in:
Doug Gregor
2024-03-28 21:26:13 -07:00
parent 220392bc7e
commit 757ebe2979
27 changed files with 252 additions and 234 deletions
+4 -4
View File
@@ -1011,9 +1011,6 @@ now codified into the ABI; the index 0 is therefore reserved.
generic-param-pack-marker ::= 'Rv' GENERIC_PARAM-INDEX // generic parameter pack marker
INVERTIBLE-KIND ::= 'c' // Copyable
INVERTIBLE-KIND ::= 'e' // Escapable
GENERIC-PARAM-COUNT ::= 'z' // zero parameters
GENERIC-PARAM-COUNT ::= INDEX // N+1 parameters
@@ -1022,7 +1019,10 @@ now codified into the ABI; the index 0 is therefore reserved.
requirement ::= protocol assoc-type-list 'RP' GENERIC-PARAM-INDEX // protocol requirement on associated type at depth
requirement ::= protocol substitution 'RQ' // protocol requirement with substitution
#if SWIFT_RUNTIME_VERSION >= 6.0
requirement ::= 'Ri' INVERTIBLE-KIND GENERIC-PARAM-INDEX // inverse requirement
requirement ::= 'Ri' INDEX GENERIC-PARAM-INDEX // inverse requirement on generic parameter where INDEX is the bit number
requirement ::= substitution 'RI' INDEX // inverse requirement with substitution
requirement ::= assoc-type-name 'Rj' INDEX GENERIC-PARAM-INDEX // inverse requirement on associated type
requirement ::= assoc-type-list 'RJ' INDEX GENERIC-PARAM-INDEX // inverse requirement on associated type at depth
#endif
requirement ::= type 'Rb' GENERIC-PARAM-INDEX // base class requirement
requirement ::= type assoc-type-name 'Rc' GENERIC-PARAM-INDEX // base class requirement on associated type
+2 -4
View File
@@ -19,15 +19,13 @@
// Name: The name of the protocol, e.g., Copyable
// Bit: The bit in the set bitset of suppressible protocols that is used
// to indicate this.
// MangleChar: The character used for the name mangling to refer to this
// protocol.
//===----------------------------------------------------------------------===//
#ifndef SUPPRESSIBLE_PROTOCOL
# error Must define SUPPRESSIBLE_PROTOCOL macro before including this file
#endif
SUPPRESSIBLE_PROTOCOL(Copyable, 0, 'c')
SUPPRESSIBLE_PROTOCOL(Escapable, 1, 'e')
SUPPRESSIBLE_PROTOCOL(Copyable, 0)
SUPPRESSIBLE_PROTOCOL(Escapable, 1)
#undef SUPPRESSIBLE_PROTOCOL
+4 -4
View File
@@ -26,7 +26,7 @@ namespace swift {
/// Describes a "suppressible" protocol, such as Copyable, which is assumed to
/// hold for all types unless explicitly suppressed.
enum class SuppressibleProtocolKind : uint8_t {
#define SUPPRESSIBLE_PROTOCOL(Name, Bit, MangleChar) Name = Bit,
#define SUPPRESSIBLE_PROTOCOL(Name, Bit) Name = Bit,
#include "swift/ABI/SuppressibleProtocols.def"
};
@@ -72,7 +72,7 @@ public:
/// Clear out all of the protocols from the set.
void clear() { bits = 0; }
#define SUPPRESSIBLE_PROTOCOL(Name, Bit, MangleChar) \
#define SUPPRESSIBLE_PROTOCOL(Name, Bit) \
bool contains##Name() const { \
return contains(SuppressibleProtocolKind::Name); \
}
@@ -82,7 +82,7 @@ public:
/// protocols.
static SuppressibleProtocolSet allKnown() {
SuppressibleProtocolSet result;
#define SUPPRESSIBLE_PROTOCOL(Name, Bit, MangleChar) \
#define SUPPRESSIBLE_PROTOCOL(Name, Bit) \
result.insert(SuppressibleProtocolKind::Name);
#include "swift/ABI/SuppressibleProtocols.def"
return result;
@@ -213,7 +213,7 @@ public:
static inline const char *
getSuppressibleProtocolKindName(SuppressibleProtocolKind kind) {
switch (kind) {
#define SUPPRESSIBLE_PROTOCOL(Name, Bit, MangleChar) \
#define SUPPRESSIBLE_PROTOCOL(Name, Bit) \
case SuppressibleProtocolKind::Name: return #Name;
#include "swift/ABI/SuppressibleProtocols.def"
}
+18
View File
@@ -596,6 +596,24 @@ protected:
GenericSignature contextSig,
BaseEntitySignature &base);
/// Describes how the subject of a requirement was mangled.
struct RequirementSubject {
enum Kind {
GenericParameter,
AssociatedType,
AssociatedTypeAtDepth,
Substitution
} kind;
/// Generic parameter at the base, if there is one. Valid for everything
/// except Substitution subjects.
GenericTypeParamType *gpBase = nullptr;
};
/// Append the subject of a generic requirement and state what kind it is.
RequirementSubject appendRequirementSubject(
CanType subjectType, GenericSignature sig);
/// Append a requirement to the mangling.
///
/// \param reqt The requirement to mangle
+2 -5
View File
@@ -19,14 +19,11 @@
#define SWIFT_AST_INVERTIBLEPROTOCOLKIND_H
#include <stdint.h>
#include <swift/ABI/SuppressibleProtocols.h>
namespace swift {
enum class InvertibleProtocolKind : uint8_t {
#define INVERTIBLE_PROTOCOL_WITH_NAME(Id, Name) Id,
#include "swift/AST/KnownProtocols.def"
};
typedef SuppressibleProtocolKind InvertibleProtocolKind;
} // end namespace swift
+1 -1
View File
@@ -136,7 +136,7 @@ PROTOCOL(AsyncIteratorProtocol)
PROTOCOL(FloatingPoint)
#define SUPPRESSIBLE_PROTOCOL(Name, Bit, MangleChar) \
#define SUPPRESSIBLE_PROTOCOL(Name, Bit) \
INVERTIBLE_PROTOCOL_WITH_NAME(Name, #Name)
#include "swift/ABI/SuppressibleProtocols.def"
-3
View File
@@ -73,9 +73,6 @@ KnownProtocolKind getKnownProtocolKind(InvertibleProtocolKind ip);
void simple_display(llvm::raw_ostream &out,
const InvertibleProtocolKind &value);
SuppressibleProtocolKind asSuppressible(InvertibleProtocolKind kind);
InvertibleProtocolKind asInvertible(SuppressibleProtocolKind kind);
} // end namespace swift
#endif
+4 -27
View File
@@ -456,38 +456,15 @@ void decodeRequirement(
} else if (child->getKind() ==
Demangle::Node::Kind::DependentGenericInverseConformanceRequirement) {
// Type child
auto constraintNode = child->getChild(1);
auto constraintNode = child->getChild(0);
if (constraintNode->getKind() != Demangle::Node::Kind::Type ||
constraintNode->getNumChildren() != 1)
return;
// Protocol child
auto protocolNode = constraintNode->getChild(0);
if (protocolNode->getKind() != Demangle::Node::Kind::Protocol ||
protocolNode->getNumChildren() != 2)
return;
auto moduleNode = protocolNode->getChild(0);
if (moduleNode->getKind() != Demangle::Node::Kind::Module ||
moduleNode->getText() != "Swift")
return;
auto protocolNameNode = protocolNode->getChild(1);
if (protocolNameNode->getKind() != Demangle::Node::Kind::Identifier)
return;
auto protocolName = protocolNameNode->getText();
using OptInvertibleKind = std::optional<InvertibleProtocolKind>;
auto protocolKind = llvm::StringSwitch<OptInvertibleKind>(protocolName)
#define INVERTIBLE_PROTOCOL_WITH_NAME(Id, Name) \
.Case(Name, InvertibleProtocolKind::Id)
#include "swift/AST/KnownProtocols.def"
.Default(std::nullopt);
if (!protocolKind)
return;
auto protocolKind =
static_cast<SuppressibleProtocolKind>(child->getChild(1)->getIndex());
inverseRequirements.push_back(
Builder.createInverseRequirement(subjectType, *protocolKind));
Builder.createInverseRequirement(subjectType, protocolKind));
continue;
}
+1 -17
View File
@@ -132,26 +132,10 @@ void swift::simple_display(llvm::raw_ostream &out,
// Metadata stores a 16-bit field for suppressible protocols. Trigger a build
// error when we assign the 15th bit so we can think about what to do.
#define SUPPRESSIBLE_PROTOCOL(Name, Bit, MangleChar) \
#define SUPPRESSIBLE_PROTOCOL(Name, Bit) \
static_assert(Bit < 15);
#include "swift/ABI/SuppressibleProtocols.def"
SuppressibleProtocolKind swift::asSuppressible(InvertibleProtocolKind kind) {
switch (kind) {
#define SUPPRESSIBLE_PROTOCOL(Name, Bit, MangleChar) \
case InvertibleProtocolKind::Name: return SuppressibleProtocolKind::Name;
#include "swift/ABI/SuppressibleProtocols.def"
}
}
InvertibleProtocolKind swift::asInvertible(SuppressibleProtocolKind kind) {
switch (kind) {
#define SUPPRESSIBLE_PROTOCOL(Name, Bit, MangleChar) \
case SuppressibleProtocolKind::Name: return InvertibleProtocolKind::Name;
#include "swift/ABI/SuppressibleProtocols.def"
}
}
namespace {
enum class SearchPathKind : uint8_t {
Import = 1 << 0,
+97 -64
View File
@@ -3420,11 +3420,34 @@ void ASTMangler::gatherGenericSignatureParts(GenericSignature sig,
}
}
ASTMangler::RequirementSubject ASTMangler::appendRequirementSubject(
CanType subjectType, GenericSignature sig) {
// Handle dependent types.
if (auto *depTy = subjectType->getAs<DependentMemberType>()) {
if (tryMangleTypeSubstitution(depTy, sig)) {
return RequirementSubject {RequirementSubject::Substitution};
}
bool isAssocTypeAtDepth = false;
GenericTypeParamType *gpBase = appendAssocType(depTy, sig,
isAssocTypeAtDepth);
addTypeSubstitution(depTy, sig);
return RequirementSubject {
isAssocTypeAtDepth ? RequirementSubject::AssociatedTypeAtDepth
: RequirementSubject::AssociatedType,
gpBase
};
}
GenericTypeParamType *gpBase = subjectType->castTo<GenericTypeParamType>();
return RequirementSubject { RequirementSubject::GenericParameter, gpBase };
}
void ASTMangler::appendRequirement(const Requirement &reqt,
GenericSignature sig,
bool lhsBaseIsProtocolSelf) {
Type FirstTy = reqt.getFirstType()->getCanonicalType();
CanType FirstTy = reqt.getFirstType()->getCanonicalType();
switch (reqt.getKind()) {
case RequirementKind::Layout:
@@ -3446,84 +3469,94 @@ void ASTMangler::appendRequirement(const Requirement &reqt,
}
}
if (auto *DT = FirstTy->getAs<DependentMemberType>()) {
if (tryMangleTypeSubstitution(DT, sig)) {
switch (reqt.getKind()) {
case RequirementKind::SameShape:
llvm_unreachable("Same-shape requirement with dependent member type?");
case RequirementKind::Conformance:
return appendOperator("RQ");
case RequirementKind::Layout:
appendOperator("RL");
appendOpParamForLayoutConstraint(reqt.getLayoutConstraint());
return;
case RequirementKind::Superclass:
return appendOperator("RB");
case RequirementKind::SameType:
return appendOperator("RS");
}
llvm_unreachable("bad requirement type");
}
bool isAssocTypeAtDepth = false;
GenericTypeParamType *gpBase = appendAssocType(DT, sig,
isAssocTypeAtDepth);
addTypeSubstitution(DT, sig);
assert(gpBase);
auto subject = appendRequirementSubject(FirstTy, sig);
switch (subject.kind) {
case RequirementSubject::GenericParameter:
switch (reqt.getKind()) {
case RequirementKind::SameShape:
llvm_unreachable("Same-shape requirement with a dependent member type?");
case RequirementKind::Conformance:
return appendOpWithGenericParamIndex(isAssocTypeAtDepth ? "RP" : "Rp",
gpBase, lhsBaseIsProtocolSelf);
case RequirementKind::Layout:
appendOpWithGenericParamIndex(isAssocTypeAtDepth ? "RM" : "Rm", gpBase,
lhsBaseIsProtocolSelf);
appendOpParamForLayoutConstraint(reqt.getLayoutConstraint());
return;
case RequirementKind::Superclass:
return appendOpWithGenericParamIndex(isAssocTypeAtDepth ? "RC" : "Rc",
gpBase, lhsBaseIsProtocolSelf);
case RequirementKind::SameType:
return appendOpWithGenericParamIndex(isAssocTypeAtDepth ? "RT" : "Rt",
gpBase, lhsBaseIsProtocolSelf);
}
llvm_unreachable("bad requirement type");
}
GenericTypeParamType *gpBase = FirstTy->castTo<GenericTypeParamType>();
switch (reqt.getKind()) {
case RequirementKind::Conformance:
return appendOpWithGenericParamIndex("R", gpBase);
return appendOpWithGenericParamIndex("R", subject.gpBase);
case RequirementKind::Layout:
appendOpWithGenericParamIndex("Rl", gpBase);
appendOpWithGenericParamIndex("Rl", subject.gpBase);
appendOpParamForLayoutConstraint(reqt.getLayoutConstraint());
return;
case RequirementKind::Superclass:
return appendOpWithGenericParamIndex("Rb", gpBase);
return appendOpWithGenericParamIndex("Rb", subject.gpBase);
case RequirementKind::SameType:
return appendOpWithGenericParamIndex("Rs", gpBase);
return appendOpWithGenericParamIndex("Rs", subject.gpBase);
case RequirementKind::SameShape:
return appendOpWithGenericParamIndex("Rh", gpBase);
return appendOpWithGenericParamIndex("Rh", subject.gpBase);
}
break;
case RequirementSubject::Substitution:
switch (reqt.getKind()) {
case RequirementKind::SameShape:
llvm_unreachable("Same-shape requirement with dependent member type?");
case RequirementKind::Conformance:
return appendOperator("RQ");
case RequirementKind::Layout:
appendOperator("RL");
appendOpParamForLayoutConstraint(reqt.getLayoutConstraint());
return;
case RequirementKind::Superclass:
return appendOperator("RB");
case RequirementKind::SameType:
return appendOperator("RS");
}
break;
case RequirementSubject::AssociatedType:
case RequirementSubject::AssociatedTypeAtDepth:
bool isAssocTypeAtDepth =
subject.kind == RequirementSubject::AssociatedTypeAtDepth;
auto gpBase = subject.gpBase;
switch (reqt.getKind()) {
case RequirementKind::SameShape:
llvm_unreachable("Same-shape requirement with a dependent member type?");
case RequirementKind::Conformance:
return appendOpWithGenericParamIndex(isAssocTypeAtDepth ? "RP" : "Rp",
gpBase, lhsBaseIsProtocolSelf);
case RequirementKind::Layout:
appendOpWithGenericParamIndex(isAssocTypeAtDepth ? "RM" : "Rm", gpBase,
lhsBaseIsProtocolSelf);
appendOpParamForLayoutConstraint(reqt.getLayoutConstraint());
return;
case RequirementKind::Superclass:
return appendOpWithGenericParamIndex(isAssocTypeAtDepth ? "RC" : "Rc",
gpBase, lhsBaseIsProtocolSelf);
case RequirementKind::SameType:
return appendOpWithGenericParamIndex(isAssocTypeAtDepth ? "RT" : "Rt",
gpBase, lhsBaseIsProtocolSelf);
}
break;
}
llvm_unreachable("bad requirement type");
}
void ASTMangler::appendInverseRequirement(const InverseRequirement &req,
GenericSignature sig,
bool lhsBaseIsProtocolSelf) {
appendOperator("Ri");
switch (req.getKind()) {
case InvertibleProtocolKind::Copyable:
appendOperator("c");
break;
case InvertibleProtocolKind::Escapable:
appendOperator("e");
break;
}
unsigned bit = static_cast<uint8_t>(req.getKind());
auto firstType = req.subject->getCanonicalType();
auto gpBase = firstType->castTo<GenericTypeParamType>();
return appendOpWithGenericParamIndex("", gpBase, lhsBaseIsProtocolSelf);
auto subject = appendRequirementSubject(firstType, sig);
switch (subject.kind) {
case RequirementSubject::GenericParameter:
appendOperator("Ri", Index(bit));
return appendOpWithGenericParamIndex("", subject.gpBase,
lhsBaseIsProtocolSelf);
case RequirementSubject::Substitution:
return appendOperator("RI", Index(bit));
case RequirementSubject::AssociatedType:
appendOperator("Rj", Index(bit));
return appendOpWithGenericParamIndex("", subject.gpBase,
lhsBaseIsProtocolSelf);
case RequirementSubject::AssociatedTypeAtDepth:
appendOperator("RJ", Index(bit));
return appendOpWithGenericParamIndex("", subject.gpBase,
lhsBaseIsProtocolSelf);
}
}
void ASTMangler::appendGenericSignatureParts(
+18 -13
View File
@@ -4093,7 +4093,7 @@ NodePointer Demangler::demangleGenericRequirement() {
enum { Generic, Assoc, CompoundAssoc, Substitution } TypeKind;
enum { Protocol, BaseClass, SameType, SameShape, Layout, PackMarker, Inverse } ConstraintKind;
std::optional<char> invertibleKind; // INVERTIBLE-KIND
NodePointer inverseKind = nullptr;
switch (nextChar()) {
case 'v': ConstraintKind = PackMarker; TypeKind = Generic; break;
case 'c': ConstraintKind = BaseClass; TypeKind = Assoc; break;
@@ -4112,8 +4112,20 @@ NodePointer Demangler::demangleGenericRequirement() {
case 'P': ConstraintKind = Protocol; TypeKind = CompoundAssoc; break;
case 'Q': ConstraintKind = Protocol; TypeKind = Substitution; break;
case 'h': ConstraintKind = SameShape; TypeKind = Generic; break;
case 'i': ConstraintKind = Inverse; TypeKind = Generic;
invertibleKind = nextChar(); break;
case 'i':
ConstraintKind = Inverse;
TypeKind = Generic;
inverseKind = demangleIndexAsNode();
if (!inverseKind)
return nullptr;
break;
case 'I':
ConstraintKind = Inverse;
TypeKind = Substitution;
inverseKind = demangleIndexAsNode();
if (!inverseKind)
return nullptr;
break;
default: ConstraintKind = Protocol; TypeKind = Generic; pushBack(); break;
}
@@ -4144,17 +4156,10 @@ NodePointer Demangler::demangleGenericRequirement() {
return createWithChildren(
Node::Kind::DependentGenericConformanceRequirement, ConstrTy,
popProtocol());
case Inverse: {
char const* name = nullptr;
switch (*invertibleKind) {
case 'c': name = "Copyable"; break;
case 'e': name = "Escapable"; break;
default: return nullptr;
}
case Inverse:
return createWithChildren(
Node::Kind::DependentGenericInverseConformanceRequirement, ConstrTy,
createSwiftType(Node::Kind::Protocol, name));
}
Node::Kind::DependentGenericInverseConformanceRequirement,
ConstrTy, inverseKind);
case BaseClass:
return createWithChildren(
Node::Kind::DependentGenericConformanceRequirement, ConstrTy,
+8 -2
View File
@@ -2865,10 +2865,16 @@ NodePointer NodePrinter::print(NodePointer Node, unsigned depth,
}
case Node::Kind::DependentGenericInverseConformanceRequirement: {
NodePointer type = Node->getChild(0);
NodePointer reqt = Node->getChild(1);
print(type, depth + 1);
Printer << ": ~";
print(reqt, depth + 1);
switch (Node->getChild(1)->getIndex()) {
#define SUPPRESSIBLE_PROTOCOL(Name, Bit) \
case Bit: Printer << "Swift." << #Name; break;
#include "swift/ABI/SuppressibleProtocols.def"
default:
Printer << "Swift.<bit " << Node->getChild(1)->getIndex() << ">";
break;
}
return nullptr;
}
case Node::Kind::DependentGenericLayoutRequirement: {
+15 -16
View File
@@ -1059,24 +1059,23 @@ ManglingError Remangler::mangleDependentGenericInverseConformanceRequirement(
DEMANGLER_ASSERT(
NumMembersAndParamIdx.first < 0 || NumMembersAndParamIdx.second, node);
// Determine the invertible protocol's mangling
const char* invertibleKind = nullptr; // INVERTIBLE-KIND
{
auto typeNode = node->getChild(1);
auto *identNode = typeNode->findByKind(Node::Kind::Identifier, 2);
DEMANGLER_ASSERT(identNode, node);
DEMANGLER_ASSERT(identNode->hasText(), node);
auto name = identNode->getText();
if (name.equals("Copyable"))
invertibleKind = "c";
else if (name.equals("Escapable"))
invertibleKind = "e";
else
return MANGLING_ERROR(ManglingError::BadNominalTypeKind, node);
switch (NumMembersAndParamIdx.first) {
case -1:
Buffer << "RI";
mangleIndex(node->getChild(1)->getIndex());
return ManglingError::Success; // substitution
case 0:
Buffer << "Ri";
break;
case 1:
Buffer << "Rj";
break;
default:
Buffer << "RJ";
break;
}
Buffer << "Ri" << invertibleKind;
mangleIndex(node->getChild(1)->getIndex());
mangleDependentGenericParamIndex(NumMembersAndParamIdx.second);
return ManglingError::Success;
}
+4 -4
View File
@@ -1268,7 +1268,7 @@ namespace {
return result;
auto checkProtocol = [&](SuppressibleProtocolKind kind) {
switch (nominal->canConformTo(asInvertible(kind))) {
switch (nominal->canConformTo(kind)) {
case TypeDecl::CanBeInvertible::Never:
case TypeDecl::CanBeInvertible::Conditionally:
result.insert(kind);
@@ -1294,7 +1294,7 @@ namespace {
return result;
auto checkProtocol = [&](SuppressibleProtocolKind kind) {
switch (nominal->canConformTo(asInvertible(kind))) {
switch (nominal->canConformTo(kind)) {
case TypeDecl::CanBeInvertible::Never:
case TypeDecl::CanBeInvertible::Always:
break;
@@ -1342,7 +1342,7 @@ namespace {
unsigned index = 0;
unsigned totalNumRequirements = 0;
for (auto kind : protocols) {
auto proto = ctx.getProtocol(getKnownProtocolKind(asInvertible(kind)));
auto proto = ctx.getProtocol(getKnownProtocolKind(kind));
SmallVector<ProtocolConformance *, 1> conformances;
(void)nominal->lookupConformance(proto, conformances);
auto conformance = conformances.front();
@@ -7037,7 +7037,7 @@ GenericArgumentMetadata irgen::addGenericRequirements(
continue;
// Insert this suppression into the set for that generic parameter.
auto suppressibleKind = asSuppressible(inverse.getKind());
auto suppressibleKind = inverse.getKind();
unsigned index = sig->getGenericParamOrdinal(genericParam);
suppressed[index].insert(suppressibleKind);
}
+4
View File
@@ -468,3 +468,7 @@ $s4testA2A5KlassCyYTF ---> test.test() -> transferring test.Klass
$s4main5KlassCACYTcMD ---> demangling cache variable for type metadata for (main.Klass) -> transferring main.Klass
$s4null19transferAsyncResultAA16NonSendableKlassCyYaYTF ---> null.transferAsyncResult() -> transferring null.NonSendableKlass
$s4null16NonSendableKlassCIegHo_ACs5Error_pIegHTrzo_TR ---> {T:} reabstraction thunk helper from @escaping @callee_guaranteed @async () -> (@owned null.NonSendableKlass) to @escaping @callee_guaranteed @async () -> transferring (@out null.NonSendableKlass, @error @owned Swift.Error)
$sSRyxG15Synchronization19AtomicRepresentableABRi_zrlMc ---> protocol conformance descriptor for < where A: ~Swift.Copyable> Swift.UnsafeBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
$sSRyxG15Synchronization19AtomicRepresentableABRi0_zrlMc ---> protocol conformance descriptor for < where A: ~Swift.Escapable> Swift.UnsafeBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
$sSRyxG15Synchronization19AtomicRepresentableABRi1_zrlMc ---> protocol conformance descriptor for < where A: ~Swift.<bit 2>> Swift.UnsafeBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
@@ -13,8 +13,8 @@ public protocol P: ~Copyable { }
public struct CallMe<U: ~Copyable> {
public enum Maybe<T: ~Copyable>: ~Copyable {
// CHECK-LABEL: @"$s4test6CallMeV5MaybeOAARiczrlE4someyAEyx_qd__Gqd__cAGmr__lFWC"
// CHECK: @"$s4test6CallMeV5MaybeOAARiczrlE4noneyAEyx_qd__GAGmr__lFWC"
// CHECK-LABEL: @"$s4test6CallMeV5MaybeOAARi_zrlE4someyAEyx_qd__Gqd__cAGmr__lFWC"
// CHECK: @"$s4test6CallMeV5MaybeOAARi_zrlE4noneyAEyx_qd__GAGmr__lFWC"
case none
case some(T)
}
@@ -46,11 +46,11 @@ public protocol Hello<Person>: ~Copyable {
// CHECK: @"$s4test5HelloP10overloadedyyqd__lFTj"
func overloaded<T>(_: borrowing T)
// CHECK: @"$s4test5HelloP10overloadedyyqd__Ricd__lFTj"
// CHECK: @"$s4test5HelloP10overloadedyyqd__Ri_d__lFTj"
func overloaded<T: ~Copyable>(_: borrowing T)
}
// CHECK: $s4test2XQVAARiczrlE1AVMi
// CHECK: $s4test2XQVAARi_zrlE1AVMi
protocol Q: ~Copyable {
associatedtype A: ~Copyable
}
@@ -104,7 +104,7 @@ func useAtomicRepresentation() {
struct Box<Wrapped: ~Copyable>: ~Copyable { }
struct List<Element: ~Copyable>: ~Copyable {
// CHECK: $s4test4ListVAARiczrlE4NodeVwst
// CHECK: $s4test4ListVAARi_zrlE4NodeVwst
struct Node: ~Copyable {
var element: Element
var next: Link
+1 -1
View File
@@ -469,7 +469,7 @@ public enum SinglePayloadNC_1<Element: Equatable>: ~Copyable {
// CHECK-SAME: ptr %Element,
// CHECK-SAME: ptr %Element.Equatable)
// CHECK: [[METADATA:%[^,]+]] = extractvalue %swift.metadata_response [[RESPONSE]], 0
// CHECK: call swiftcc void @"$s24moveonly_value_functions18EmptyDeinitingNC_1VAARiczrlEfD"(
// CHECK: call swiftcc void @"$s24moveonly_value_functions18EmptyDeinitingNC_1VAARi_zrlEfD"(
// CHECK-SAME: ptr [[METADATA]])
// CHECK: }
@@ -30,10 +30,10 @@ public enum NeverCopyable<Wrapped: ~Copyable>: ~Copyable {
public struct NonCopyable: ~Copyable { }
// CHECK: @"$s4test1CCMF" =
// CHECK-SAME: @"symbolic _____yxG 4test21ConditionallyCopyableOAARiczrlE"
// CHECK-SAME: @"get_type_metadata Riczl4test21ConditionallyCopyableOyAA03NonC0VG.3"
// CHECK-SAME: @"symbolic _____yxG 4test21ConditionallyCopyableOAARiczrlE"
// CHECK-SAME: @"get_type_metadata Riczl4test21ConditionallyCopyableOyAA03NonC0VG.3"
// CHECK-SAME: @"symbolic _____yxG 4test21ConditionallyCopyableOAARi_zrlE"
// CHECK-SAME: @"get_type_metadata Ri_zl4test21ConditionallyCopyableOyAA03NonC0VG.3"
// CHECK-SAME: @"symbolic _____yxG 4test21ConditionallyCopyableOAARi_zrlE"
// CHECK-SAME: @"get_type_metadata Ri_zl4test21ConditionallyCopyableOyAA03NonC0VG.3"
public class C<T: ~Copyable> {
var ccT: ConditionallyCopyable<T> = .none
var ccNC: ConditionallyCopyable<NonCopyable> = .none
+1 -1
View File
@@ -12,7 +12,7 @@ public struct FA<T> {
public subscript(_ int: Int) -> T {
// CHECK-LABEL: sil [ossa] @read : {{.*}} {
// function_ref UnsafeMutablePointer.subscript.unsafeAddressor
// CHECK: [[ADDRESSOR:%[^,]+]] = function_ref @$sSpsRiczrlEyxSicilu
// CHECK: [[ADDRESSOR:%[^,]+]] = function_ref @$sSpsRi_zrlEyxSicilu
// CHECK: [[POINTER:%[^,]+]] = apply [[ADDRESSOR]]
// CHECK: [[RAW_POINTER:%[^,]+]] = struct_extract [[POINTER]]
// CHECK: [[ADDR:%[^,]+]] = pointer_to_address [[RAW_POINTER]]
+2 -2
View File
@@ -614,7 +614,7 @@ class SuperSub : SuperBase {
// CHECK: [[ARG_COPY:%.*]] = copy_value [[ARG]]
// CHECK: [[PA:%.*]] = partial_apply [callee_guaranteed] [[INNER]]([[ARG_COPY]])
// CHECK: [[CVT:%.*]] = convert_escape_to_noescape [not_guaranteed] [[PA]]
// CHECK: [[TRY_APPLY_AUTOCLOSURE:%.*]] = function_ref @$ss2qqoiyxxSgn_xyKXKtKRiczlF :
// CHECK: [[TRY_APPLY_AUTOCLOSURE:%.*]] = function_ref @$ss2qqoiyxxSgn_xyKXKtKRi_zlF :
// CHECK: try_apply [[TRY_APPLY_AUTOCLOSURE]]<()>({{.*}}, {{.*}}, [[CVT]]) : {{.*}}, normal [[NORMAL_BB:bb1]], error [[ERROR_BB:bb2]]
// CHECK: [[NORMAL_BB]]{{.*}}
// CHECK: } // end sil function '[[INNER_FUNC_1]]'
@@ -643,7 +643,7 @@ class SuperSub : SuperBase {
// CHECK: [[ARG_COPY:%.*]] = copy_value [[ARG]]
// CHECK: [[PA:%.*]] = partial_apply [callee_guaranteed] [[INNER]]([[ARG_COPY]])
// CHECK: [[CVT:%.*]] = convert_escape_to_noescape [not_guaranteed] [[PA]] :
// CHECK: [[TRY_APPLY_FUNC:%.*]] = function_ref @$ss2qqoiyxxSgn_xyKXKtKRiczlF :
// CHECK: [[TRY_APPLY_FUNC:%.*]] = function_ref @$ss2qqoiyxxSgn_xyKXKtKRi_zlF :
// CHECK: try_apply [[TRY_APPLY_FUNC]]<()>({{.*}}, {{.*}}, [[CVT]]) : {{.*}}, normal [[NORMAL_BB:bb1]], error [[ERROR_BB:bb2]]
// CHECK: [[NORMAL_BB]]{{.*}}
// CHECK: } // end sil function '[[INNER_FUNC_1]]'
@@ -224,7 +224,7 @@ func testCovariantSelfProperty6(p: any P) {
// CHECK: [[WITNESS:%[0-9]+]] = witness_method $@opened([[OPENED_ID]], any P) Self, #P.covariantSelfProperty7!getter : <Self where Self : P> (Self) -> () -> ((Self) -> ()) -> ()
// CHECK: [[RESULT_FN:%[0-9]+]] = apply [[WITNESS]]<@opened([[OPENED_ID]], any P) Self>([[OPENED_COPY]]) : $@convention(witness_method: P) <τ_0_0 where τ_0_0 : P> (@in_guaranteed τ_0_0) -> @owned @callee_guaranteed @substituted <τ_0_0> (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for <τ_0_0>) -> () for <τ_0_0>
// CHECK: [[STEP1:%[0-9]+]] = convert_function [[RESULT_FN]] : $@callee_guaranteed @substituted <τ_0_0> (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for <τ_0_0>) -> () for <@opened([[OPENED_ID]], any P) Self> to $@callee_guaranteed (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for <@opened([[OPENED_ID]], any P) Self>) -> ()
// CHECK: [[THUNK:%[0-9]+]] = function_ref @$sxRiczRiezlyxIsgn_Iegg_42existential_member_accesses_self_assoctype1P_pIgn_Iegg_AaBRzlTR : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@guaranteed @noescape @callee_guaranteed (@in_guaranteed any P) -> (), @guaranteed @callee_guaranteed (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for <τ_0_0>) -> ()) -> ()
// CHECK: [[THUNK:%[0-9]+]] = function_ref @$sxRi_zRi0_zlyxIsgn_Iegg_42existential_member_accesses_self_assoctype1P_pIgn_Iegg_AaBRzlTR : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@guaranteed @noescape @callee_guaranteed (@in_guaranteed any P) -> (), @guaranteed @callee_guaranteed (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for <τ_0_0>) -> ()) -> ()
// CHECK: partial_apply [callee_guaranteed] [[THUNK]]<@opened([[OPENED_ID]], any P) Self>([[STEP1]]) : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@guaranteed @noescape @callee_guaranteed (@in_guaranteed any P) -> (), @guaranteed @callee_guaranteed (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for <τ_0_0>) -> ()) -> ()
// CHECK: debug_value %{{[0-9]+}} : $@callee_guaranteed (@guaranteed @noescape @callee_guaranteed (@in_guaranteed any P) -> ()) -> (), let, name "x"
func testCovariantSelfProperty7(p: any P) {
@@ -508,7 +508,7 @@ func testCovariantAssocProperty6(p: any P) {
// CHECK: [[WITNESS:%[0-9]+]] = witness_method $@opened([[OPENED_ID]], any P) Self, #P.covariantAssocProperty7!getter : <Self where Self : P> (Self) -> () -> ((Self.A) -> ()) -> ()
// CHECK: [[RESULT_FN:%[0-9]+]] = apply [[WITNESS]]<@opened([[OPENED_ID]], any P) Self>([[OPENED_COPY]]) : $@convention(witness_method: P) <τ_0_0 where τ_0_0 : P> (@in_guaranteed τ_0_0) -> @owned @callee_guaranteed @substituted <τ_0_0> (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for <τ_0_0>) -> () for <τ_0_0.A>
// CHECK: [[STEP1:%[0-9]+]] = convert_function [[RESULT_FN]] : $@callee_guaranteed @substituted <τ_0_0> (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for <τ_0_0>) -> () for <@opened([[OPENED_ID]], any P) Self.A> to $@callee_guaranteed (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for <@opened([[OPENED_ID]], any P) Self.A>) -> ()
// CHECK: [[THUNK:%[0-9]+]] = function_ref @$sxRiczRiezly1A42existential_member_accesses_self_assoctype1PPQzIsgn_Iegg_ypIgn_Iegg_AbCRzlTR : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@guaranteed @noescape @callee_guaranteed (@in_guaranteed Any) -> (), @guaranteed @callee_guaranteed (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for <τ_0_0.A>) -> ()) -> ()
// CHECK: [[THUNK:%[0-9]+]] = function_ref @$sxRi_zRi0_zly1A42existential_member_accesses_self_assoctype1PPQzIsgn_Iegg_ypIgn_Iegg_AbCRzlTR : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@guaranteed @noescape @callee_guaranteed (@in_guaranteed Any) -> (), @guaranteed @callee_guaranteed (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for <τ_0_0.A>) -> ()) -> ()
// CHECK: partial_apply [callee_guaranteed] [[THUNK]]<@opened([[OPENED_ID]], any P) Self>([[STEP1]]) : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@guaranteed @noescape @callee_guaranteed (@in_guaranteed Any) -> (), @guaranteed @callee_guaranteed (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for <τ_0_0.A>) -> ()) -> ()
// CHECK: debug_value %{{[0-9]+}} : $@callee_guaranteed (@guaranteed @noescape @callee_guaranteed (@in_guaranteed Any) -> ()) -> (), let, name "x"
func testCovariantAssocProperty7(p: any P) {
+25 -25
View File
@@ -33,15 +33,15 @@ let global__old__: any MyProto = S()
// CHECK: sil_global private @$s4test13global__new___Wz : $Builtin.Word
// DEMANGLED: test.global__new__ : any test.MyProto<Self: ~Swift.Copyable>
// CHECK: sil_global hidden [let] @$s4test13global__new__AA7MyProto_pRics_XPvp : $any MyProto & ~Copyable
// CHECK: sil_global hidden [let] @$s4test13global__new__AA7MyProto_pRi_s_XPvp : $any MyProto & ~Copyable
let global__new__: any MyProto & ~Copyable = S()
// DEMANGLED: test.global__none__ : any test.Nothing<Self: ~Swift.Copyable, Self: ~Swift.Escapable>
// CHECK: sil_global hidden [let] @$s4test14global__none__AA7Nothing_pRics_RiesXPvp : $any Nothing & ~Copyable & ~Escapable
// CHECK: sil_global hidden [let] @$s4test14global__none__AA7Nothing_pRi_s_Ri0_sXPvp : $any Nothing & ~Copyable & ~Escapable
let global__none__: any Nothing & ~Copyable & ~Escapable = S()
// DEMANGLED: test.global__none2__ : any test.Empty & test.Nothing<Self: ~Swift.Copyable, Self: ~Swift.Escapable>
// CHECK: sil_global hidden [let] @$s4test15global__none2__AA5Empty_AA7NothingpRics_RiesXPvp : $any Empty & Nothing & ~Copyable & ~Escapable
// CHECK: sil_global hidden [let] @$s4test15global__none2__AA5Empty_AA7NothingpRi_s_Ri0_sXPvp : $any Empty & Nothing & ~Copyable & ~Escapable
let global__none2__: any Nothing & ~Copyable & Empty & ~Escapable = S()
// DEMANGLED: test.global__any1__ : Any
@@ -61,15 +61,15 @@ let global__any3__: Any = S()
let global__any4__: any Copyable & Escapable = S()
// DEMANGLED: test.global__inv1__ : any Any<Self: ~Swift.Copyable>
// CHECK: sil_global hidden [let] @$s4test14global__inv1__ypRics_XPvp : $any ~Copyable
// CHECK: sil_global hidden [let] @$s4test14global__inv1__ypRi_s_XPvp : $any ~Copyable
let global__inv1__: any ~Copyable = S()
// DEMANGLED: test.global__inv2__ : any Any<Self: ~Swift.Escapable>
// CHECK: sil_global hidden [let] @$s4test14global__inv2__ypRies_XPvp : $any ~Escapable
// CHECK: sil_global hidden [let] @$s4test14global__inv2__ypRi0_s_XPvp : $any ~Escapable
let global__inv2__: any ~Escapable = S()
// DEMANGLED: test.global__inv3__ : any Any<Self: ~Swift.Copyable, Self: ~Swift.Escapable>
// CHECK: sil_global hidden [let] @$s4test14global__inv3__ypRics_RiesXPvp : $any ~Copyable & ~Escapable
// CHECK: sil_global hidden [let] @$s4test14global__inv3__ypRi_s_Ri0_sXPvp : $any ~Copyable & ~Escapable
let global__inv3__: any ~Escapable & ~Copyable = S()
// DEMANGLED: test.global__anyObj1__ : Swift.AnyObject
@@ -86,14 +86,14 @@ let global__anyObj2__: any AnyObject = ClassDef()
// CHECK: sil hidden [global_init] [ossa] @$s4test13global__old__AA7MyProto_pvau : $@convention(thin) () -> Builtin.RawPointer {
// CHECK: sil private [global_init_once_fn] [ossa] @$s4test13global__new___WZ : $@convention(c) (Builtin.RawPointer) -> () {
// CHECK: sil hidden [global_init] [ossa] @$s4test13global__new__AA7MyProto_pRics_XPvau : $@convention(thin) () -> Builtin.RawPointer {
// CHECK: sil hidden [global_init] [ossa] @$s4test13global__new__AA7MyProto_pRi_s_XPvau : $@convention(thin) () -> Builtin.RawPointer {
// DEMANGLED: test.global__computed__.getter : any Any<Self: ~Swift.Copyable>
// CHECK: sil hidden [ossa] @$s4test18global__computed__ypRics_XPvg : $@convention(thin) () -> @out any ~Copyable {
// CHECK: sil hidden [ossa] @$s4test18global__computed__ypRi_s_XPvg : $@convention(thin) () -> @out any ~Copyable {
// DEMANGLED: test.global__computed__.setter : any Any<Self: ~Swift.Copyable>
// CHECK: sil hidden [ossa] @$s4test18global__computed__ypRics_XPvs : $@convention(thin) (@in any ~Copyable) -> () {
// CHECK: sil hidden [ossa] @$s4test18global__computed__ypRi_s_XPvs : $@convention(thin) (@in any ~Copyable) -> () {
var global__computed__: any ~Copyable {
get { S() }
set {}
@@ -106,7 +106,7 @@ public struct A<T: ~Copyable>: ~Copyable {
// in a constrained extension.
// DEMANGLED: (extension in test):test.A< where A: ~Swift.Copyable>.foo() -> ()
// CHECK: sil [ossa] @$s4test1AVAARiczrlE3fooyyF : $@convention(method) <T where T : ~Copyable> (@guaranteed A<T>) -> () {
// CHECK: sil [ossa] @$s4test1AVAARi_zrlE3fooyyF : $@convention(method) <T where T : ~Copyable> (@guaranteed A<T>) -> () {
public func foo() {}
// DEMANGLED: test.A.weird() -> ()
@@ -114,36 +114,36 @@ public struct A<T: ~Copyable>: ~Copyable {
public func weird() where T: Copyable {}
// DEMANGLED: variable initialization expression of (extension in test):test.A< where A: ~Swift.Copyable>.property : Swift.Int
// CHECK: sil [transparent] [ossa] @$s4test1AVAARiczrlE8propertySivpfi : $@convention(thin) <T where T : ~Copyable> () -> Int {
// CHECK: sil [transparent] [ossa] @$s4test1AVAARi_zrlE8propertySivpfi : $@convention(thin) <T where T : ~Copyable> () -> Int {
// DEMANGLED: (extension in test):test.A< where A: ~Swift.Copyable>.property.getter : Swift.Int
// CHECK: sil [transparent] [serialized] [ossa] @$s4test1AVAARiczrlE8propertySivg : $@convention(method) <T where T : ~Copyable> (@guaranteed A<T>) -> Int {
// CHECK: sil [transparent] [serialized] [ossa] @$s4test1AVAARi_zrlE8propertySivg : $@convention(method) <T where T : ~Copyable> (@guaranteed A<T>) -> Int {
// DEMANGLED: (extension in test):test.A< where A: ~Swift.Copyable>.property.setter : Swift.Int
// CHECK: sil [transparent] [serialized] [ossa] @$s4test1AVAARiczrlE8propertySivs : $@convention(method) <T where T : ~Copyable> (Int, @inout A<T>) -> () {
// CHECK: sil [transparent] [serialized] [ossa] @$s4test1AVAARi_zrlE8propertySivs : $@convention(method) <T where T : ~Copyable> (Int, @inout A<T>) -> () {
// DEMANGLED: (extension in test):test.A< where A: ~Swift.Copyable>.property.modify : Swift.Int
// CHECK: sil [transparent] [serialized] [ossa] @$s4test1AVAARiczrlE8propertySivM : $@yield_once @convention(method) <T where T : ~Copyable> (@inout A<T>) -> @yields @inout Int {
// CHECK: sil [transparent] [serialized] [ossa] @$s4test1AVAARi_zrlE8propertySivM : $@yield_once @convention(method) <T where T : ~Copyable> (@inout A<T>) -> @yields @inout Int {
public var property: Int = 0
// DEMANGLED: (extension in test):test.A< where A: ~Swift.Copyable>.computed.getter : Swift.String
// CHECK: sil [ossa] @$s4test1AVAARiczrlE8computedSSvg : $@convention(method) <T where T : ~Copyable> (@guaranteed A<T>) -> @owned String {
// CHECK: sil [ossa] @$s4test1AVAARi_zrlE8computedSSvg : $@convention(method) <T where T : ~Copyable> (@guaranteed A<T>) -> @owned String {
public var computed: String {
""
}
// DEMANGLED: static (extension in test):test.A< where A: ~Swift.Copyable>.forceInits() -> test.A<A>
// CHECK: sil hidden [ossa] @$s4test1AVAARiczrlE10forceInitsACyxGyFZ : $@convention(method) <T where T : ~Copyable> (@thin A<T>.Type) -> @owned A<T> {
// CHECK: sil hidden [ossa] @$s4test1AVAARi_zrlE10forceInitsACyxGyFZ : $@convention(method) <T where T : ~Copyable> (@thin A<T>.Type) -> @owned A<T> {
static func forceInits() -> Self {
_ = Self(property: 100)
return Self()
}
// DEMANGLED: (extension in test):test.A< where A: ~Swift.Copyable>.init(property: Swift.Int) -> test.A<A>
// CHECK: sil hidden [ossa] @$s4test1AVAARiczrlE8propertyACyxGSi_tcfC : $@convention(method) <T where T : ~Copyable> (Int, @thin A<T>.Type) -> @owned A<T> {
// CHECK: sil hidden [ossa] @$s4test1AVAARi_zrlE8propertyACyxGSi_tcfC : $@convention(method) <T where T : ~Copyable> (Int, @thin A<T>.Type) -> @owned A<T> {
// DEMANGLED: (extension in test):test.A< where A: ~Swift.Copyable>.init() -> test.A<A>
// CHECK: sil hidden [ossa] @$s4test1AVAARiczrlEACyxGycfC : $@convention(method) <T where T : ~Copyable> (@thin A<T>.Type) -> @owned A<T> {
// CHECK: sil hidden [ossa] @$s4test1AVAARi_zrlEACyxGycfC : $@convention(method) <T where T : ~Copyable> (@thin A<T>.Type) -> @owned A<T> {
}
extension A: Copyable {}
@@ -151,7 +151,7 @@ extension A: Copyable {}
// <T: ~Copyable>
extension A where T: ~Copyable {
// DEMANGLED: (extension in test):test.A< where A: ~Swift.Copyable>.bar() -> ()
// CHECK: sil hidden [ossa] @$s4test1AVAARiczrlE3baryyF : $@convention(method) <T where T : ~Copyable> (@guaranteed A<T>) -> () {
// CHECK: sil hidden [ossa] @$s4test1AVAARi_zrlE3baryyF : $@convention(method) <T where T : ~Copyable> (@guaranteed A<T>) -> () {
func bar() {}
// DEMANGLED: test.A.weird2() -> ()
@@ -162,7 +162,7 @@ extension A where T: ~Copyable {
// <T: ~Copyable & NoncopyableProto>
extension A where T: ~Copyable & NoncopyableProto {
// DEMANGLED: (extension in test):test.A< where A: test.NoncopyableProto, A: ~Swift.Copyable>.dumb() -> ()
// CHECK: sil hidden [ossa] @$s4test1AVA2A16NoncopyableProtoRzRiczrlE4dumbyyF : $@convention(method) <T where T : NoncopyableProto, T : ~Copyable> (@guaranteed A<T>) -> () {
// CHECK: sil hidden [ossa] @$s4test1AVA2A16NoncopyableProtoRzRi_zrlE4dumbyyF : $@convention(method) <T where T : NoncopyableProto, T : ~Copyable> (@guaranteed A<T>) -> () {
func dumb() {}
}
@@ -220,7 +220,7 @@ struct C<T> {
func foo() {}
// DEMANGLED: test.C.something<A where A1: ~Swift.Copyable>() -> A1
// CHECK: sil hidden [ossa] @$s4test1CV9somethingqd__yRicd__lF : $@convention(method) <T><U where U : ~Copyable> (C<T>) -> @out U {
// CHECK: sil hidden [ossa] @$s4test1CV9somethingqd__yRi_d__lF : $@convention(method) <T><U where U : ~Copyable> (C<T>) -> @out U {
func something<U: ~Copyable>() -> U {
fatalError()
}
@@ -282,7 +282,7 @@ public struct E<T: ~Copyable>: ~Copyable {
public func __existential1__(_ t: consuming any ~Copyable) {}
// DEMANGLE: (extension in test):test.E< where A: ~Swift.Copyable>.__existential2__(__owned any Any<Self: ~Swift.Copyable>) -> ()
// CHECK: sil [ossa] @$s4test1EVAARiczrlE16__existential2__yyypRics_XPnF : $@convention(method) <T where T : ~Copyable> (@in any ~Copyable, @guaranteed E<T>) -> () {
// CHECK: sil [ossa] @$s4test1EVAARi_zrlE16__existential2__yyypRi_s_XPnF : $@convention(method) <T where T : ~Copyable> (@in any ~Copyable, @guaranteed E<T>) -> () {
public func __existential2__(_ t: consuming any ~Copyable) {}
// DEMANGLED: test.E.something<A>() -> A1
@@ -293,7 +293,7 @@ public struct E<T: ~Copyable>: ~Copyable {
}
// DEMANGLED: (extension in test):test.E< where A: ~Swift.Copyable>.something<A>() -> A1
// CHECK: sil [ossa] @$s4test1EVAARiczrlE9somethingqd__ylF : $@convention(method) <T><U> (@guaranteed E<T>) -> @out U {
// CHECK: sil [ossa] @$s4test1EVAARi_zrlE9somethingqd__ylF : $@convention(method) <T><U> (@guaranteed E<T>) -> @out U {
public func something<U>() -> U {
fatalError()
}
@@ -315,10 +315,10 @@ public struct E<T: ~Copyable>: ~Copyable {
// NOTE: the implicit initializers still have inverses!
// DEMANGLED: (extension in test):test.E< where A: ~Swift.Copyable>.init() -> test.E<A>
// CHECK: sil hidden [ossa] @$s4test1EVAARiczrlEACyxGycfC : $@convention(method) <T where T : ~Copyable> (@thin E<T>.Type) -> @owned E<T> {
// CHECK: sil hidden [ossa] @$s4test1EVAARi_zrlEACyxGycfC : $@convention(method) <T where T : ~Copyable> (@thin E<T>.Type) -> @owned E<T> {
// DEMANGLED: (extension in test):test.E< where A: ~Swift.Copyable>.init(property: Swift.Int) -> test.E<A>
// CHECK: sil hidden [ossa] @$s4test1EVAARiczrlE8propertyACyxGSi_tcfC : $@convention(method) <T where T : ~Copyable> (Int, @thin E<T>.Type) -> @owned E<T> {
// CHECK: sil hidden [ossa] @$s4test1EVAARi_zrlE8propertyACyxGSi_tcfC : $@convention(method) <T where T : ~Copyable> (Int, @thin E<T>.Type) -> @owned E<T> {
}
func forceInit() {
@@ -9,13 +9,13 @@
struct Basic<T: ~Copyable> {
// DEMANGLED: (extension in test):test.Basic< where A: ~Swift.Copyable>.cali2() -> ()
// CHECK: $s4test5BasicVAARiczrlE5cali2yyF
// CHECK: $s4test5BasicVAARi_zrlE5cali2yyF
func cali2() {}
}
extension Basic where T: ~Copyable {
// DEMANGLED: (extension in test):test.Basic< where A: ~Swift.Copyable>.cali1() -> ()
// CHECK: $s4test5BasicVAARiczrlE5cali1yyF
// CHECK: $s4test5BasicVAARi_zrlE5cali1yyF
func cali1() {}
}
@@ -45,7 +45,7 @@ extension _G_ {
func foo() where T: Copyable {}
// DEMANGLED: test._G_._H_._I_.foo< where A: ~Swift.Copyable>() -> ()
// CHECK: $s4test3_G_V3_H_V3_I_V3fooyyRiczrlF
// CHECK: $s4test3_G_V3_H_V3_I_V3fooyyRi_zrlF
func foo() {}
}
}
@@ -62,15 +62,15 @@ struct Gloop<T: ~Copyable> {}
extension Gloop where T: ~Copyable {
struct Crash<B: ~Escapable> {
// DEMANGLED: (extension in test):test.Gloop< where A: ~Swift.Copyable>.Crash.foo< where A1: ~Swift.Escapable>() -> ()
// CHECK: $s4test5GloopVAARiczrlE5CrashV3fooyyRied__rlF
// CHECK: $s4test5GloopVAARi_zrlE5CrashV3fooyyRi0_d__rlF
func foo() {}
// DEMANGLED: test.Gloop.Crash.foo< where A1: ~Swift.Escapable>() -> ()
// CHECK: $s4test5GloopV5CrashV3fooyyRied__rlF
// CHECK: $s4test5GloopV5CrashV3fooyyRi0_d__rlF
func foo() where T: Copyable {}
// DEMANGLED: (extension in test):test.Gloop< where A: ~Swift.Copyable>.Crash.foo() -> ()
// CHECK: $s4test5GloopVAARiczrlE5CrashV3fooyyF
// CHECK: $s4test5GloopVAARi_zrlE5CrashV3fooyyF
func foo() where B: Escapable {}
// DEMANGLED: test.Gloop.Crash.foo() -> ()
@@ -87,22 +87,22 @@ struct X<A: ~Copyable> {
func g() where A: Copyable, B: Copyable {}
// DEMANGLED: (extension in test):test.X.Y< where A1: ~Swift.Copyable>.g() -> ()
// CHECK: $s4test1XV1YVAARicd__rlE1gyyF
// CHECK: $s4test1XV1YVAARi_d__rlE1gyyF
func g() where A: Copyable {}
// DEMANGLED: (extension in test):test.X.Y< where A: ~Swift.Copyable>.g() -> ()
// CHECK: $s4test1XV1YVAARiczrlE1gyyF
// CHECK: $s4test1XV1YVAARi_zrlE1gyyF
func g() where B: Copyable {}
// DEMANGLED: (extension in test):test.X.Y< where A: ~Swift.Copyable, A1: ~Swift.Copyable>.g() -> ()
// CHECK: $s4test1XV1YVAARiczRicd__rlE1gyyF
// CHECK: $s4test1XV1YVAARi_zRi_d__rlE1gyyF
func g() {}
}
}
struct OverloadComputed<T: ~Copyable> {
// DEMANGLED: extension in test):test.OverloadComputed< where A: ~Swift.Copyable>.obtain() -> A
// CHECK: $s4test16OverloadComputedVAARiczrlE6obtainxyF
// CHECK: $s4test16OverloadComputedVAARi_zrlE6obtainxyF
func obtain() -> T { fatalError() }
}
extension OverloadComputed {
@@ -112,6 +112,6 @@ extension OverloadComputed {
}
extension OverloadComputed where T: ~Copyable {
// DEMANGLED: (extension in test):test.OverloadComputed< where A: ~Swift.Copyable>.prop.getter : A
// CHECK: $s4test16OverloadComputedVAARiczrlE4propxvg
// CHECK: $s4test16OverloadComputedVAARi_zrlE4propxvg
var prop: T { return obtain() }
}
@@ -16,7 +16,7 @@ public func f() {
// We shouldn't have @autoclosure and @escaping attributes in the lowered tuple type:
// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sIg_Ieg_Ieggg_xRiczRiezlyytIsgr_xRiczRiezlyytIsegr_ytIegnnr_TR : $@convention(thin) (@in_guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <()>, @in_guaranteed @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <()>, @guaranteed @callee_guaranteed (@guaranteed @noescape @callee_guaranteed () -> (), @guaranteed @callee_guaranteed () -> ()) -> ()) -> @out ()
// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sIg_Ieg_Ieggg_xRi_zRi0_zlyytIsgr_xRi_zRi0_zlyytIsegr_ytIegnnr_TR : $@convention(thin) (@in_guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <()>, @in_guaranteed @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <()>, @guaranteed @callee_guaranteed (@guaranteed @noescape @callee_guaranteed () -> (), @guaranteed @callee_guaranteed () -> ()) -> ()) -> @out ()
// The one-element vararg tuple ([Int]...) should be exploded and not treated as opaque,
// even though its materializable:
+4 -4
View File
@@ -53,19 +53,19 @@ func check(_ t: borrowing CondCopyableEnum<NC>) {}
// CHECK: sil hidden [ossa] @$s4main5checkyyAA16CondCopyableEnumOyxGlF : $@convention(thin) <T> (@in_guaranteed CondCopyableEnum<T>) -> () {
func check<T>(_ t: CondCopyableEnum<T>) {}
// CHECK: sil hidden [ossa] @$s4main5checkyyAA16CondCopyableEnumOyxGRiczlF : $@convention(thin) <U where U : ~Copyable> (@in_guaranteed CondCopyableEnum<U>) -> () {
// CHECK: sil hidden [ossa] @$s4main5checkyyAA16CondCopyableEnumOyxGRi_zlF : $@convention(thin) <U where U : ~Copyable> (@in_guaranteed CondCopyableEnum<U>) -> () {
func check<U: ~Copyable>(_ t: borrowing CondCopyableEnum<U>) {}
// CHECK: sil hidden [ossa] @$s4main5checkyyAA7NoCopyP_pF : $@convention(thin) (@in_guaranteed any NoCopyP) -> () {
func check(_ t: any NoCopyP) {}
// CHECK: sil hidden [ossa] @$s4main5checkyyAA7NoCopyP_pRics_XPF : $@convention(thin) (@in_guaranteed any NoCopyP & ~Copyable) -> () {
// CHECK: sil hidden [ossa] @$s4main5checkyyAA7NoCopyP_pRi_s_XPF : $@convention(thin) (@in_guaranteed any NoCopyP & ~Copyable) -> () {
func check(_ t: borrowing any NoCopyP & ~Copyable) {}
// CHECK: sil hidden [ossa] @$s4main5checkyyAA7NoCopyP_pRics_XPnF : $@convention(thin) (@in any NoCopyP & ~Copyable) -> () {
// CHECK: sil hidden [ossa] @$s4main5checkyyAA7NoCopyP_pRi_s_XPnF : $@convention(thin) (@in any NoCopyP & ~Copyable) -> () {
func check(_ t: consuming any NoCopyP & ~Copyable) {}
// CHECK: sil hidden [ossa] @$s4main5checkyyAA7NoCopyP_pRics_XPzF : $@convention(thin) (@inout any NoCopyP & ~Copyable) -> () {
// CHECK: sil hidden [ossa] @$s4main5checkyyAA7NoCopyP_pRi_s_XPzF : $@convention(thin) (@inout any NoCopyP & ~Copyable) -> () {
func check(_ t: inout any NoCopyP & ~Copyable) {}
struct MyStruct<T: ~Copyable>: ~Copyable {
@@ -258,8 +258,8 @@ func test11<each T>() -> Use<repeat each T> {
return Use()
}
// CHECK-LABEL: sil {{.*}} @$s4main6test11AA3UseVyxxQp_QPGyRvzlF :
// CHECK: function_ref @$sSS_xq_RiczRiezRic_Rie_r0_lyxSbIsegnr_xQpSiQSiIegk_SSxSbRiczRiezlyxIsegnd_xQp_QSiSiIegokd_RvzlTR : $@convention(thin) <each τ_0_0> (@guaranteed @callee_guaranteed () -> @pack_out Pack{String, repeat @callee_guaranteed @substituted <τ_0_0, τ_0_1> (@in_guaranteed τ_0_0) -> @out τ_0_1 for <each τ_0_0, Bool>, Int}) -> (@owned String, @pack_out Pack{repeat @callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> Bool for <each τ_0_0>}, Int)
// CHECK-LABEL: sil shared {{.*}} @$sSS_xq_RiczRiezRic_Rie_r0_lyxSbIsegnr_xQpSiQSiIegk_SSxSbRiczRiezlyxIsegnd_xQp_QSiSiIegokd_RvzlTR :
// CHECK: function_ref @$sSS_xq_Ri_zRi0_zRi__Ri0__r0_lyxSbIsegnr_xQpSiQSiIegk_SSxSbRi_zRi0_zlyxIsegnd_xQp_QSiSiIegokd_RvzlTR : $@convention(thin) <each τ_0_0> (@guaranteed @callee_guaranteed () -> @pack_out Pack{String, repeat @callee_guaranteed @substituted <τ_0_0, τ_0_1> (@in_guaranteed τ_0_0) -> @out τ_0_1 for <each τ_0_0, Bool>, Int}) -> (@owned String, @pack_out Pack{repeat @callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> Bool for <each τ_0_0>}, Int)
// CHECK-LABEL: sil shared {{.*}} @$sSS_xq_Ri_zRi0_zRi__Ri0__r0_lyxSbIsegnr_xQpSiQSiIegk_SSxSbRi_zRi0_zlyxIsegnd_xQp_QSiSiIegokd_RvzlTR :
// Create the inner pack argument.
// CHECK: [[PACK:%.*]] = alloc_pack $Pack{String, repeat @callee_guaranteed @substituted <τ_0_0, τ_0_1> (@in_guaranteed τ_0_0) -> @out τ_0_1 for <each T, Bool>, Int}
// - Set up the string result temporary.
+12 -12
View File
@@ -450,22 +450,22 @@ Added: _$sSO15Synchronization27AtomicOptionalRepresentableAAMc
Added: _$sSO15Synchronization27AtomicOptionalRepresentableAAWP
// protocol conformance descriptor for < where A: ~Swift.Copyable> Swift.UnsafePointer<A> : Synchronization.AtomicRepresentable in Synchronization
Added: _$sSPyxG15Synchronization19AtomicRepresentableABRiczrlMc
Added: _$sSPyxG15Synchronization19AtomicRepresentableABRi_zrlMc
// protocol witness table for < where A: ~Swift.Copyable> Swift.UnsafePointer<A> : Synchronization.AtomicRepresentable in Synchronization
Added: _$sSPyxG15Synchronization19AtomicRepresentableABRiczrlWP
Added: _$sSPyxG15Synchronization19AtomicRepresentableABRi_zrlWP
// protocol conformance descriptor for < where A: ~Swift.Copyable> Swift.UnsafePointer<A> : Synchronization.AtomicOptionalRepresentable in Synchronization
Added: _$sSPyxG15Synchronization27AtomicOptionalRepresentableABRiczrlMc
Added: _$sSPyxG15Synchronization27AtomicOptionalRepresentableABRi_zrlMc
// protocol witness table for < where A: ~Swift.Copyable> Swift.UnsafePointer<A> : Synchronization.AtomicOptionalRepresentable in Synchronization
Added: _$sSPyxG15Synchronization27AtomicOptionalRepresentableABRiczrlWP
Added: _$sSPyxG15Synchronization27AtomicOptionalRepresentableABRi_zrlWP
// protocol conformance descriptor for < where A: ~Swift.Copyable> Swift.UnsafeBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
Added: _$sSRyxG15Synchronization19AtomicRepresentableABRiczrlMc
Added: _$sSRyxG15Synchronization19AtomicRepresentableABRi_zrlMc
// protocol witness table for < where A: ~Swift.Copyable> Swift.UnsafeBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
Added: _$sSRyxG15Synchronization19AtomicRepresentableABRiczrlWP
Added: _$sSRyxG15Synchronization19AtomicRepresentableABRi_zrlWP
// protocol conformance descriptor for Swift.UnsafeRawPointer : Synchronization.AtomicRepresentable in Synchronization
Added: _$sSV15Synchronization19AtomicRepresentableAAMc
@@ -510,22 +510,22 @@ Added: _$sSi15Synchronization19AtomicRepresentableAAMc
Added: _$sSi15Synchronization19AtomicRepresentableAAWP
// protocol conformance descriptor for < where A: ~Swift.Copyable> Swift.UnsafeMutablePointer<A> : Synchronization.AtomicRepresentable in Synchronization
Added: _$sSpyxG15Synchronization19AtomicRepresentableABRiczrlMc
Added: _$sSpyxG15Synchronization19AtomicRepresentableABRi_zrlMc
// protocol witness table for < where A: ~Swift.Copyable> Swift.UnsafeMutablePointer<A> : Synchronization.AtomicRepresentable in Synchronization
Added: _$sSpyxG15Synchronization19AtomicRepresentableABRiczrlWP
Added: _$sSpyxG15Synchronization19AtomicRepresentableABRi_zrlWP
// protocol conformance descriptor for < where A: ~Swift.Copyable> Swift.UnsafeMutablePointer<A> : Synchronization.AtomicOptionalRepresentable in Synchronization
Added: _$sSpyxG15Synchronization27AtomicOptionalRepresentableABRiczrlMc
Added: _$sSpyxG15Synchronization27AtomicOptionalRepresentableABRi_zrlMc
// protocol witness table for < where A: ~Swift.Copyable> Swift.UnsafeMutablePointer<A> : Synchronization.AtomicOptionalRepresentable in Synchronization
Added: _$sSpyxG15Synchronization27AtomicOptionalRepresentableABRiczrlWP
Added: _$sSpyxG15Synchronization27AtomicOptionalRepresentableABRi_zrlWP
// protocol conformance descriptor for < where A: ~Swift.Copyable> Swift.UnsafeMutableBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
Added: _$sSryxG15Synchronization19AtomicRepresentableABRiczrlMc
Added: _$sSryxG15Synchronization19AtomicRepresentableABRi_zrlMc
// protocol witness table for < where A: ~Swift.Copyable> Swift.UnsafeMutableBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
Added: _$sSryxG15Synchronization19AtomicRepresentableABRiczrlWP
Added: _$sSryxG15Synchronization19AtomicRepresentableABRi_zrlWP
// protocol conformance descriptor for Swift.UInt : Synchronization.AtomicRepresentable in Synchronization
Added: _$sSu15Synchronization19AtomicRepresentableAAMc