Skip to content

Commit 9beb466

Browse files
committed
---
yaml --- r: 347374 b: refs/heads/master c: a3c6d87 h: refs/heads/master
1 parent a379eb3 commit 9beb466

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: c6f84004a03b8891487bb1e9965168bab88687d1
2+
refs/heads/master: a3c6d875e9d645809756565f5ca581299f322e5f
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/IRGen/GenProto.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,12 @@ bindParameterSource(SILParameterInfo param, unsigned paramIndex,
619619
llvm::Value *metadata = getParameter(paramIndex);
620620
IGF.bindLocalTypeDataFromTypeMetadata(paramType, IsInexact, metadata,
621621
MetadataState::Complete);
622+
} else if (metatype->getRepresentation() == MetatypeRepresentation::ObjC) {
623+
paramType = metatype.getInstanceType();
624+
llvm::Value *objcMetatype = getParameter(paramIndex);
625+
auto *metadata = emitObjCMetadataRefForMetadata(IGF, objcMetatype);
626+
IGF.bindLocalTypeDataFromTypeMetadata(paramType, IsInexact, metadata,
627+
MetadataState::Complete);
622628
}
623629
return;
624630
}

trunk/test/IRGen/objc_generic_class_metadata.sil

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,22 @@ entry(%0 : $Subclass, %1 : $NSDictionary):
9393
// CHECK: [[TMP:%.*]] = call swiftcc %swift.metadata_response @"$sSo12GenericClassCMa"([[INT]] 255)
9494
// CHECK: [[CLASS:%.*]] = extractvalue %swift.metadata_response [[TMP]], 0
9595
// CHECK: call swiftcc %swift.metadata_response @swift_getTupleTypeMetadata2([[INT]] %0, %swift.type* [[CLASS]], %swift.type* @"$sSiN", i8* null,
96+
97+
class K<T> {}
98+
99+
sil @$useMeta : $@convention(thin) <P> () -> ()
100+
101+
// CHECK-LABEL: define void @an_objc_method(i8*, i8*)
102+
// CHECK: [[C:%.*]] = bitcast i8* %0 to %objc_class*
103+
// CHECK: [[M:%.*]] = call %swift.type* @swift_getObjCClassMetadata(%objc_class* [[C]])
104+
// CHECK: [[M2:%.*]] = bitcast %swift.type* [[M]] to %swift.type**
105+
// CHECK: [[P:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[M2]]
106+
// CHECK: [[P2:%.*]] = load %swift.type*, %swift.type** [[P]]
107+
// CHECK: call swiftcc void @"$useMeta"(%swift.type* [[P2]])
108+
// CHECK: ret void
109+
sil @an_objc_method : $@convention(objc_method) <P> (@objc_metatype K<P>.Type) -> () {
110+
bb0(%0 : $@objc_metatype K<P>.Type):
111+
%2 = function_ref @$useMeta : $@convention(thin) <τ_0_0> () -> ()
112+
%3 = apply %2<P>() : $@convention(thin) <τ_0_0 > () -> ()
113+
return undef : $()
114+
}

0 commit comments

Comments
 (0)