Skip to content

Commit fee32cc

Browse files
committed
ASTMangler: Mangle which generic parameters are packs
1 parent 1e2daa2 commit fee32cc

File tree

12 files changed

+108
-33
lines changed

12 files changed

+108
-33
lines changed

docs/ABI/Mangling.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -887,8 +887,10 @@ now codified into the ABI; the index 0 is therefore reserved.
887887

888888
::
889889

890-
generic-signature ::= requirement* 'l' // one generic parameter
891-
generic-signature ::= requirement* 'r' GENERIC-PARAM-COUNT* 'l'
890+
generic-signature ::= requirement* generic-param-pack-marker* 'l' // one generic parameter
891+
generic-signature ::= requirement* generic-param-pack-marker* 'r' GENERIC-PARAM-COUNT* 'l'
892+
893+
generic-param-pack-marker ::= 'Rv' GENERIC_PARAM-INDEX // generic parameter pack marker
892894

893895
GENERIC-PARAM-COUNT ::= 'z' // zero parameters
894896
GENERIC-PARAM-COUNT ::= INDEX // N+1 parameters
@@ -931,9 +933,11 @@ now codified into the ABI; the index 0 is therefore reserved.
931933
LAYOUT-SIZE ::= INDEX // Size only
932934
LAYOUT-SIZE-AND-ALIGNMENT ::= INDEX INDEX // Size followed by alignment
933935

936+
A generic signature begins with an optional list of requirements.
934937

938+
This is followed by an optional list of generic-param-pack-markers to record
939+
which generic parameters are packs (variadic).
935940

936-
A generic signature begins with an optional list of requirements.
937941
The ``<GENERIC-PARAM-COUNT>`` describes the number of generic parameters at
938942
each depth of the signature. As a special case, no ``<GENERIC-PARAM-COUNT>``
939943
values indicates a single generic parameter at the outermost depth::

include/swift/Demangling/DemangleNodes.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ NODE(DependentGenericParamType)
6363
NODE(DependentGenericSameTypeRequirement)
6464
NODE(DependentGenericSameShapeRequirement)
6565
NODE(DependentGenericLayoutRequirement)
66+
NODE(DependentGenericParamPackMarker)
6667
NODE(DependentGenericSignature)
6768
NODE(DependentGenericType)
6869
NODE(DependentMemberType)

lib/AST/ASTMangler.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,7 +2979,7 @@ void ASTMangler::appendRequirement(const Requirement &reqt,
29792979
if (tryMangleTypeSubstitution(DT, sig)) {
29802980
switch (reqt.getKind()) {
29812981
case RequirementKind::SameShape:
2982-
llvm_unreachable("Same-shape requirement not supported here");
2982+
llvm_unreachable("Same-shape requirement with dependent member type?");
29832983
case RequirementKind::Conformance:
29842984
return appendOperator("RQ");
29852985
case RequirementKind::Layout:
@@ -3038,14 +3038,20 @@ void ASTMangler::appendRequirement(const Requirement &reqt,
30383038

30393039
void ASTMangler::appendGenericSignatureParts(
30403040
GenericSignature sig,
3041-
ArrayRef<CanTypeWrapper<GenericTypeParamType>> params,
3041+
ArrayRef<CanGenericTypeParamType> params,
30423042
unsigned initialParamDepth,
30433043
ArrayRef<Requirement> requirements) {
30443044
// Mangle the requirements.
30453045
for (const Requirement &reqt : requirements) {
30463046
appendRequirement(reqt, sig);
30473047
}
30483048

3049+
// Mangle which generic parameters are pack parameters.
3050+
for (auto param : params) {
3051+
if (param->isParameterPack())
3052+
appendOpWithGenericParamIndex("Rv", param);
3053+
}
3054+
30493055
if (params.size() == 1 && params[0]->getDepth() == initialParamDepth)
30503056
return appendOperator("l");
30513057

lib/Demangling/Demangler.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ static bool isEntity(Node::Kind kind) {
7676

7777
static bool isRequirement(Node::Kind kind) {
7878
switch (kind) {
79+
case Node::Kind::DependentGenericParamPackMarker:
7980
case Node::Kind::DependentGenericSameTypeRequirement:
8081
case Node::Kind::DependentGenericSameShapeRequirement:
8182
case Node::Kind::DependentGenericLayoutRequirement:
@@ -3788,11 +3789,12 @@ NodePointer Demangler::demangleGenericSignature(bool hasParamCounts) {
37883789
}
37893790

37903791
NodePointer Demangler::demangleGenericRequirement() {
3791-
3792+
37923793
enum { Generic, Assoc, CompoundAssoc, Substitution } TypeKind;
3793-
enum { Protocol, BaseClass, SameType, SameShape, Layout } ConstraintKind;
3794+
enum { Protocol, BaseClass, SameType, SameShape, Layout, PackMarker } ConstraintKind;
37943795

37953796
switch (nextChar()) {
3797+
case 'v': ConstraintKind = PackMarker; TypeKind = Generic; break;
37963798
case 'c': ConstraintKind = BaseClass; TypeKind = Assoc; break;
37973799
case 'C': ConstraintKind = BaseClass; TypeKind = CompoundAssoc; break;
37983800
case 'b': ConstraintKind = BaseClass; TypeKind = Generic; break;
@@ -3832,6 +3834,9 @@ NodePointer Demangler::demangleGenericRequirement() {
38323834
}
38333835

38343836
switch (ConstraintKind) {
3837+
case PackMarker:
3838+
return createWithChild(
3839+
Node::Kind::DependentGenericParamPackMarker, ConstrTy);
38353840
case Protocol:
38363841
return createWithChildren(
38373842
Node::Kind::DependentGenericConformanceRequirement, ConstrTy,

lib/Demangling/NodePrinter.cpp

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ class NodePrinter {
368368
case Node::Kind::DefaultAssociatedConformanceAccessor:
369369
case Node::Kind::DependentAssociatedTypeRef:
370370
case Node::Kind::DependentGenericSignature:
371+
case Node::Kind::DependentGenericParamPackMarker:
371372
case Node::Kind::DependentGenericParamCount:
372373
case Node::Kind::DependentGenericConformanceRequirement:
373374
case Node::Kind::DependentGenericLayoutRequirement:
@@ -984,39 +985,82 @@ class NodePrinter {
984985

985986
void printGenericSignature(NodePointer Node, unsigned depth) {
986987
Printer << '<';
987-
988-
unsigned gpDepth = 0;
988+
989989
unsigned numChildren = Node->getNumChildren();
990-
for (;
991-
gpDepth < numChildren
992-
&& Node->getChild(gpDepth)->getKind()
993-
== Node::Kind::DependentGenericParamCount;
994-
++gpDepth) {
990+
991+
unsigned numGenericParams = 0;
992+
for (; numGenericParams < numChildren; ++numGenericParams) {
993+
if (Node->getChild(numGenericParams)->getKind()
994+
!= Node::Kind::DependentGenericParamCount) {
995+
break;
996+
}
997+
}
998+
999+
unsigned firstRequirement = numGenericParams;
1000+
for (; firstRequirement < numChildren; ++firstRequirement) {
1001+
auto child = Node->getChild(firstRequirement);
1002+
if (child->getKind() == Node::Kind::Type)
1003+
child = child->getChild(0);
1004+
if (child->getKind() != Node::Kind::DependentGenericParamPackMarker) {
1005+
break;
1006+
}
1007+
}
1008+
1009+
auto isGenericParamPack = [&](unsigned depth, unsigned index) {
1010+
for (unsigned i = numGenericParams; i < firstRequirement; ++i) {
1011+
auto child = Node->getChild(i);
1012+
if (child->getKind() != Node::Kind::DependentGenericParamPackMarker)
1013+
continue;
1014+
child = child->getChild(0);
1015+
1016+
if (child->getKind() != Node::Kind::Type)
1017+
continue;
1018+
1019+
child = child->getChild(0);
1020+
if (child->getKind() != Node::Kind::DependentGenericParamType)
1021+
continue;
1022+
1023+
if (index == child->getChild(0)->getIndex() &&
1024+
depth == child->getChild(1)->getIndex()) {
1025+
return true;
1026+
}
1027+
}
1028+
1029+
return false;
1030+
};
1031+
1032+
unsigned gpDepth = 0;
1033+
for (; gpDepth < numGenericParams; ++gpDepth) {
9951034
if (gpDepth != 0)
9961035
Printer << "><";
997-
1036+
9981037
unsigned count = Node->getChild(gpDepth)->getIndex();
9991038
for (unsigned index = 0; index < count; ++index) {
10001039
if (index != 0)
10011040
Printer << ", ";
1041+
10021042
// Limit the number of printed generic parameters. In practice this
10031043
// it will never be exceeded. The limit is only important for malformed
10041044
// symbols where count can be really huge.
10051045
if (index >= 128) {
10061046
Printer << "...";
10071047
break;
10081048
}
1049+
1050+
if (isGenericParamPack(gpDepth, index))
1051+
Printer << "each ";
1052+
10091053
// FIXME: Depth won't match when a generic signature applies to a
10101054
// method in generic type context.
10111055
Printer << Options.GenericParameterName(gpDepth, index);
10121056
}
10131057
}
1014-
1015-
if (gpDepth != numChildren) {
1058+
1059+
if (firstRequirement != numChildren) {
10161060
if (Options.DisplayWhereClauses) {
10171061
Printer << " where ";
1018-
for (unsigned i = gpDepth; i < numChildren; ++i) {
1019-
if (i > gpDepth)
1062+
for (unsigned i = firstRequirement; i < numChildren; ++i) {
1063+
if (i > firstRequirement)
10201064
Printer << ", ";
10211065
print(Node->getChild(i), depth + 1);
10221066
}
@@ -2681,6 +2725,7 @@ NodePointer NodePrinter::print(NodePointer Node, unsigned depth,
26812725
return nullptr;
26822726
}
26832727
case Node::Kind::DependentGenericParamCount:
2728+
case Node::Kind::DependentGenericParamPackMarker:
26842729
printer_unreachable("should be printed as a child of a "
26852730
"DependentGenericSignature");
26862731
case Node::Kind::DependentGenericConformanceRequirement: {

lib/Demangling/OldRemangler.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,6 +1941,11 @@ ManglingError Remangler::mangleDependentPseudogenericSignature(Node *node,
19411941
return mangleDependentGenericSignature(node, depth + 1);
19421942
}
19431943

1944+
ManglingError Remangler::mangleDependentGenericParamPackMarker(Node *node,
1945+
unsigned depth) {
1946+
return MANGLING_ERROR(ManglingError::UnsupportedNodeKind, node);
1947+
}
1948+
19441949
ManglingError Remangler::mangleDependentGenericSignature(Node *node,
19451950
unsigned depth) {
19461951
auto i = node->begin(), e = node->end();

lib/Demangling/Remangler.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,15 @@ ManglingError Remangler::mangleDependentGenericSignature(Node *node,
11601160
return ManglingError::Success;
11611161
}
11621162

1163+
ManglingError Remangler::mangleDependentGenericParamPackMarker(Node *node,
1164+
unsigned depth) {
1165+
DEMANGLER_ASSERT(node->getNumChildren() == 1, node);
1166+
DEMANGLER_ASSERT(node->getChild(0)->getKind() == Node::Kind::Type, node);
1167+
Buffer << "Rv";
1168+
mangleDependentGenericParamIndex(node->getChild(0)->getChild(0));
1169+
return ManglingError::Success;
1170+
}
1171+
11631172
ManglingError Remangler::mangleDependentGenericType(Node *node,
11641173
unsigned depth) {
11651174
RETURN_IF_ERROR(

test/DebugInfo/variadic-generics-count.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
// REQUIRES: asserts
77

88
public func f1<T...>(ts: repeat each T) {
9-
// CHECK: define {{.*}} @"$s1a2f12tsyxxQp_tlF"(%swift.opaque** {{.*}}, i{{32|64}} [[COUNT1_1:.*]], %swift.type** {{.*}})
9+
// CHECK: define {{.*}} @"$s1a2f12tsyxxQp_tRvzlF"(%swift.opaque** {{.*}}, i{{32|64}} [[COUNT1_1:.*]], %swift.type** {{.*}})
1010
// CHECK-DAG: store i{{32|64}} [[COUNT1_1]], i{{32|64}}* %[[COUNT1_1_A:.*]], align
1111
// CHECK-DAG: call void @llvm.dbg.declare({{.*}}[[COUNT1_1_A]], metadata ![[COUNT1_1_VAR:[0-9]+]], metadata !DIExpression())
1212
// CHECK-LABEL: ret void
1313
}
1414

1515
public func f2<U..., V...>(us: repeat each U, vs: repeat each V) {
16-
// CHECK: define {{.*}} @"$s1a2f22us2vsyxxQp_q_q_Qptr0_lF"(%swift.opaque** {{.*}}, %swift.opaque** {{.*}}, i{{32|64}} [[COUNT2_1:.*]], i{{32|64}} [[COUNT2_2:.*]], %swift.type** {{.*}}, %swift.type** {{.*}})
16+
// CHECK: define {{.*}} @"$s1a2f22us2vsyxxQp_q_q_QptRvzRv_r0_lF"(%swift.opaque** {{.*}}, %swift.opaque** {{.*}}, i{{32|64}} [[COUNT2_1:.*]], i{{32|64}} [[COUNT2_2:.*]], %swift.type** {{.*}}, %swift.type** {{.*}})
1717
// CHECK-DAG: store i{{32|64}} [[COUNT2_1]], i{{32|64}}* %[[COUNT2_1_A:.*]], align
1818
// CHECK-DAG: store i{{32|64}} [[COUNT2_2]], i{{32|64}}* %[[COUNT2_2_A:.*]], align
1919
// CHECK-DAG: call void @llvm.dbg.declare({{.*}}[[COUNT2_1_A]], metadata ![[COUNT2_1_VAR:[0-9]+]], metadata !DIExpression())
@@ -22,14 +22,14 @@ public func f2<U..., V...>(us: repeat each U, vs: repeat each V) {
2222
}
2323

2424
public func f3<T...>(ts: repeat each T, more_ts: repeat each T) {
25-
// CHECK: define {{.*}} @"$s1a2f32ts05more_B0yxxQp_xxQptlF"(%swift.opaque** {{.*}}, %swift.opaque** {{.*}}, i{{32|64}} [[COUNT3_1:.*]], %swift.type** {{.*}})
25+
// CHECK: define {{.*}} @"$s1a2f32ts05more_B0yxxQp_xxQptRvzlF"(%swift.opaque** {{.*}}, %swift.opaque** {{.*}}, i{{32|64}} [[COUNT3_1:.*]], %swift.type** {{.*}})
2626
// CHECK-DAG: store i{{32|64}} [[COUNT3_1]], i{{32|64}}* %[[COUNT3_1_A:.*]], align
2727
// CHECK-DAG: call void @llvm.dbg.declare({{.*}}[[COUNT3_1_A]], metadata ![[COUNT3_1_VAR:[0-9]+]], metadata !DIExpression())
2828
// CHECK-LABEL: ret void
2929
}
3030

3131
public func f4<U..., V...>(us: repeat (each U, each V)) {
32-
// CHECK: define {{.*}} @"$s1a2f42usyx_q_txQp_tq_Rhzr0_lF"(%swift.opaque** {{.*}}, i{{32|64}} [[COUNT4_1:.*]], %swift.type** {{.*}}, %swift.type** {{.*}})
32+
// CHECK: define {{.*}} @"$s1a2f42usyx_q_txQp_tq_RhzRvzRv_r0_lF"(%swift.opaque** {{.*}}, i{{32|64}} [[COUNT4_1:.*]], %swift.type** {{.*}}, %swift.type** {{.*}})
3333
// CHECK-DAG: store i{{32|64}} [[COUNT4_1]], i{{32|64}}* %[[COUNT4_1_A:.*]], align
3434
// CHECK-DAG: call void @llvm.dbg.declare({{.*}}[[COUNT4_1_A]], metadata ![[COUNT4_1_VAR:[0-9]+]], metadata !DIExpression())
3535
// CHECK-LABEL: ret void

test/DebugInfo/variadic-generics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// REQUIRES: asserts
77

88
public func foo<T...>(args: repeat each T) {
9-
// CHECK: define {{.*}} @"$s1a3foo4argsyxxQp_tlF"
9+
// CHECK: define {{.*}} @"$s1a3foo4argsyxxQp_tRvzlF"
1010
// CHECK-SAME: %swift.type** %[[TYPE_PACK_ARG:.*]])
1111
// CHECK: %[[TYPE_PACK_ALLOCA:.*]] = alloca %swift.type**
1212
// CHECK: call void @llvm.dbg.declare(metadata %swift.type*** %[[TYPE_PACK_ALLOCA]], metadata ![[TYPE_PACK_VAR:[0-9]+]], metadata !DIExpression())

test/IRGen/variadic_generic_functions.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
// REQUIRES: PTRSIZE=64
77

8-
// CHECK-LABEL: define hidden swiftcc void @"$s26variadic_generic_functions2f11tyxxQp_tlF"(%swift.opaque** noalias nocapture %0, i64 %1, %swift.type** %T)
8+
// CHECK-LABEL: define hidden swiftcc void @"$s26variadic_generic_functions2f11tyxxQp_tRvzlF"(%swift.opaque** noalias nocapture %0, i64 %1, %swift.type** %T)
99
func f1<T...>(t: repeat each T) {}
1010

11-
// CHECK-LABEL: define hidden swiftcc void @"$s26variadic_generic_functions2f21t1uyxxQp_q_q_Qptr0_lF"(%swift.opaque** noalias nocapture %0, %swift.opaque** noalias nocapture %1, i64 %2, i64 %3, %swift.type** %T, %swift.type** %U)
11+
// CHECK-LABEL: define hidden swiftcc void @"$s26variadic_generic_functions2f21t1uyxxQp_q_q_QptRvzRv_r0_lF"(%swift.opaque** noalias nocapture %0, %swift.opaque** noalias nocapture %1, i64 %2, i64 %3, %swift.type** %T, %swift.type** %U)
1212
func f2<T..., U...>(t: repeat each T, u: repeat each U) {}
1313

14-
// CHECK-LABEL: define hidden swiftcc void @"$s26variadic_generic_functions2f31t1uyxxQp_q_xQptq_Rhzr0_lF"(%swift.opaque** noalias nocapture %0, %swift.opaque** noalias nocapture %1, i64 %2, %swift.type** %T, %swift.type** %U)
14+
// CHECK-LABEL: define hidden swiftcc void @"$s26variadic_generic_functions2f31t1uyxxQp_q_xQptq_RhzRvzRv_r0_lF"(%swift.opaque** noalias nocapture %0, %swift.opaque** noalias nocapture %1, i64 %2, %swift.type** %T, %swift.type** %U)
1515
func f3<T..., U...>(t: repeat each T, u: repeat each U) where (repeat (each T, each U)): Any {}
1616

1717
protocol P {}

test/SILGen/pack_expansion_type.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55

66
// XFAIL: OS=windows-msvc
77

8-
// CHECK-LABEL: sil [ossa] @$s19pack_expansion_type16variadicFunction1t1ux_q_txQp_txxQp_q_xQptq_Rhzr0_lF : $@convention(thin) <T..., U... where ((T, U)...) : Any> (@pack_guaranteed Pack{repeat each T}, @pack_guaranteed Pack{repeat each U}) -> @pack_out Pack{repeat (each T, each U)} {
8+
// CHECK-LABEL: sil [ossa] @$s19pack_expansion_type16variadicFunction1t1ux_q_txQp_txxQp_q_xQptq_RhzRvzRv_r0_lF : $@convention(thin) <T..., U... where ((T, U)...) : Any> (@pack_guaranteed Pack{repeat each T}, @pack_guaranteed Pack{repeat each U}) -> @pack_out Pack{repeat (each T, each U)} {
99
// CHECK: bb0(%0 : $*Pack{repeat (each T, each U)}, %1 : $*Pack{repeat each T}, %2 : $*Pack{repeat each U}):
1010
public func variadicFunction<T..., U...>(t: repeat each T, u: repeat each U) -> (repeat (each T, each U)) {}
1111

1212
public struct VariadicType<T...> {
13-
// CHECK-LABEL: sil [ossa] @$s19pack_expansion_type12VariadicTypeV14variadicMethod1t1ux_qd__txQp_txxQp_qd__xQptqd__RhzlF : $@convention(method) <T...><U... where ((T, U)...) : Any> (@pack_guaranteed Pack{repeat each T}, @pack_guaranteed Pack{repeat each U}, VariadicType<repeat each T>) -> @pack_out Pack{repeat (each T, each U)} {
13+
// CHECK-LABEL: sil [ossa] @$s19pack_expansion_type12VariadicTypeV14variadicMethod1t1ux_qd__txQp_txxQp_qd__xQptqd__RhzRvd__lF : $@convention(method) <T...><U... where ((T, U)...) : Any> (@pack_guaranteed Pack{repeat each T}, @pack_guaranteed Pack{repeat each U}, VariadicType<repeat each T>) -> @pack_out Pack{repeat (each T, each U)} {
1414
// CHECK: bb0(%0 : $*Pack{repeat (each T, each U)}, %1 : $*Pack{repeat each T}, %2 : $*Pack{repeat each U}, %3 : $VariadicType<repeat each T>):
1515
public func variadicMethod<U...>(t: repeat each T, u: repeat each U) -> (repeat (each T, each U)) {}
1616

17-
// CHECK-LABEL: sil [ossa] @$s19pack_expansion_type12VariadicTypeV13takesFunction1tyqd__qd__Qp_txxQpXE_tlF : $@convention(method) <T...><U...> (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0..., τ_0_1..., τ_0_2..., τ_0_3...> (@pack_guaranteed Pack{repeat each τ_0_0}) -> @pack_out Pack{repeat each τ_0_2} for <T, T, U, U>, VariadicType<repeat each T>) -> () {
17+
// CHECK-LABEL: sil [ossa] @$s19pack_expansion_type12VariadicTypeV13takesFunction1tyqd__qd__Qp_txxQpXE_tRvd__lF : $@convention(method) <T...><U...> (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0..., τ_0_1..., τ_0_2..., τ_0_3...> (@pack_guaranteed Pack{repeat each τ_0_0}) -> @pack_out Pack{repeat each τ_0_2} for <T, T, U, U>, VariadicType<repeat each T>) -> () {
1818
// CHECK: bb0(%0 : @guaranteed $@noescape @callee_guaranteed @substituted <τ_0_0..., τ_0_1..., τ_0_2..., τ_0_3...> (@pack_guaranteed Pack{repeat each τ_0_0}) -> @pack_out Pack{repeat each τ_0_2} for <T, T, U, U>, %1 : $VariadicType<repeat each T>):
1919
public func takesFunction<U...>(t: (repeat each T) -> (repeat each U)) {}
2020
}
2121

22-
// CHECK-LABEL: sil hidden [ossa] @$s19pack_expansion_type17variadicMetatypesyyxxQplF : $@convention(thin) <T...> (@pack_guaranteed Pack{repeat each T}) -> () {
22+
// CHECK-LABEL: sil hidden [ossa] @$s19pack_expansion_type17variadicMetatypesyyxxQpRvzlF : $@convention(thin) <T...> (@pack_guaranteed Pack{repeat each T}) -> () {
2323
// CHECK: bb0(%0 : $*Pack{repeat each T}):
2424
// CHECK: metatype $@thin VariadicType<>.Type
2525
// CHECK: metatype $@thin VariadicType<Int>.Type

test/SILGen/variadic-generics.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func receive_simple_owned<T...>(_ args: repeat __owned each T) {}
2424
// CHECK-NEXT: pack_element_set [[STRING_TEMP]] : $*String into [[STRING_INDEX]] of [[PACK]] : $*Pack{Int, Float, String}
2525
// Perform the call.
2626
// CHECK-NEXT: // function_ref
27-
// CHECK-NEXT: [[FN:%.*]] = function_ref @$s4main14receive_simpleyyxxQplF : $@convention(thin) <τ_0_0...> (@pack_guaranteed Pack{repeat each τ_0_0}) -> ()
27+
// CHECK-NEXT: [[FN:%.*]] = function_ref @$s4main14receive_simpleyyxxQpRvzlF : $@convention(thin) <τ_0_0...> (@pack_guaranteed Pack{repeat each τ_0_0}) -> ()
2828
// CHECK-NEXT: apply [[FN]]<Pack{Int, Float, String}>([[PACK]])
2929
// Clean up.
3030
// CHECK-NEXT: destroy_addr [[STRING_TEMP]] : $*String
@@ -57,7 +57,7 @@ func scalar_test0(i: Int, f: Float, s: String) {
5757
// CHECK-NEXT: pack_element_set [[STRING_TEMP]] : $*String into [[STRING_INDEX]] of [[PACK]] : $*Pack{Int, Float, String}
5858
// Perform the call.
5959
// CHECK-NEXT: // function_ref
60-
// CHECK-NEXT: [[FN:%.*]] = function_ref @$s4main20receive_simple_ownedyyxxQpnlF : $@convention(thin) <τ_0_0...> (@pack_owned Pack{repeat each τ_0_0}) -> ()
60+
// CHECK-NEXT: [[FN:%.*]] = function_ref @$s4main20receive_simple_ownedyyxxQpnRvzlF : $@convention(thin) <τ_0_0...> (@pack_owned Pack{repeat each τ_0_0}) -> ()
6161
// CHECK-NEXT: apply [[FN]]<Pack{Int, Float, String}>([[PACK]])
6262
// Clean up.
6363
// CHECK-NEXT: dealloc_stack [[STRING_TEMP]] : $*String

0 commit comments

Comments
 (0)