Skip to content

Commit c4d1126

Browse files
committed
---
yaml --- r: 317151 b: refs/heads/master-rebranch c: a8f770f h: refs/heads/master i: 317149: b49a3c0 317147: c0abad9 317143: da623bd 317135: a779587 317119: 6c56bd8
1 parent 8ff4917 commit c4d1126

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1457,4 +1457,4 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-02-a: ddd2b2976aa9bfde5f20fe37f6bd2
14571457
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-03-a: 171cc166f2abeb5ca2a4003700a8a78a108bd300
14581458
refs/heads/benlangmuir-patch-1: baaebaf39d52f3bf36710d4fe40cf212e996b212
14591459
refs/heads/i-do-redeclare: 8c4e6d5de5c1e3f0a2cedccf319df713ea22c48e
1460-
refs/heads/master-rebranch: 8b9a8667004c9333212f467e52f395283192d280
1460+
refs/heads/master-rebranch: a8f770f9ae6de132336d4911b42dadd9091e4bca

branches/master-rebranch/include/swift/Demangling/TypeDecoder.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,13 @@ class TypeDecoder {
246246
case NodeKind::CFunctionPointer:
247247
case NodeKind::ThinFunctionType:
248248
case NodeKind::NoEscapeFunctionType:
249+
case NodeKind::AutoClosureType:
250+
case NodeKind::EscapingAutoClosureType:
249251
case NodeKind::FunctionType: {
250252
if (Node->getNumChildren() < 2)
251253
return BuiltType();
252254

255+
// FIXME: autoclosure is not represented in function metadata
253256
FunctionTypeFlags flags;
254257
if (Node->getKind() == NodeKind::ObjCBlock) {
255258
flags = flags.withConvention(FunctionMetadataConvention::Block);
@@ -275,7 +278,9 @@ class TypeDecoder {
275278
flags =
276279
flags.withNumParameters(parameters.size())
277280
.withParameterFlags(hasParamFlags)
278-
.withEscaping(Node->getKind() == NodeKind::FunctionType);
281+
.withEscaping(
282+
Node->getKind() == NodeKind::FunctionType ||
283+
Node->getKind() == NodeKind::EscapingAutoClosureType);
279284

280285
auto result = decodeMangledType(Node->getChild(isThrow ? 2 : 1));
281286
if (!result) return BuiltType();

branches/master-rebranch/test/IRGen/function_metadata.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ func test_arch() {
5353
arch({(x: inout Int, y: Double, z: String, w: Int8) -> () in })
5454

5555
// CHECK-LABEL: define{{( protected)?}} linkonce_odr hidden swiftcc %swift.metadata_response @"$syyyccMa"
56-
// CHECK: call %swift.type* @swift_getFunctionTypeMetadata1(i64 67108865
56+
// CHECK: call %swift.type* @swift_getFunctionTypeMetadata1({{i(32|64)}} 67108865
5757
arch({(x: @escaping () -> ()) -> () in })
5858
}

branches/master-rebranch/test/Runtime/demangleToMetadata.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ func f1_owned(x: __owned AnyObject) { }
4545

4646
func f2_variadic_inout(x: ()..., y: inout ()) { }
4747

48+
func f1_escaping(_: @escaping (Int) -> Float) { }
49+
func f1_autoclosure(_: @autoclosure () -> Float) { }
50+
func f1_escaping_autoclosure(_: @autoclosure @escaping () -> Float) { }
51+
4852
DemangleToMetadataTests.test("function types") {
4953
// Conventions
5054
expectEqual(type(of: f0), _typeByMangledName("yyc")!)
@@ -77,6 +81,13 @@ DemangleToMetadataTests.test("function types") {
7781
// A function type that hasn't been built before.
7882
expectEqual("(Int, Float, Double, String, Character, UInt, Bool) -> ()",
7983
String(describing: _typeByMangledName("yySi_SfSdSSs9CharacterVSuSbtc")!))
84+
85+
// Escaping
86+
expectEqual(type(of: f1_escaping), _typeByMangledName("ySfSicc")!)
87+
88+
// Autoclosure
89+
expectEqual(type(of: f1_autoclosure), _typeByMangledName("ySfyXKc")!)
90+
expectEqual(type(of: f1_escaping_autoclosure), _typeByMangledName("ySfyXAc")!)
8091
}
8192

8293
DemangleToMetadataTests.test("metatype types") {

0 commit comments

Comments
 (0)