File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed
SwiftCompilerSources/Sources/Optimizer/PassManager
include/swift/SILOptimizer Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,14 @@ extension Context {
74
74
return _bridged. lookupSpecializedVTable ( classType. bridged) . vTable
75
75
}
76
76
77
+ func getSpecializedConformance( of genericConformance: Conformance ,
78
+ for type: AST . `Type` ,
79
+ substitutions: SubstitutionMap ) -> Conformance
80
+ {
81
+ let c = _bridged. getSpecializedConformance ( genericConformance. bridged, type. bridged, substitutions. bridged)
82
+ return Conformance ( bridged: c)
83
+ }
84
+
77
85
func notifyNewFunction( function: Function , derivedFrom: Function ) {
78
86
_bridged. addFunctionToPassManagerWorklist ( function. bridged, derivedFrom. bridged)
79
87
}
Original file line number Diff line number Diff line change @@ -332,6 +332,10 @@ struct BridgedPassContext {
332
332
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE
333
333
OptionalBridgedVTable lookupSpecializedVTable (BridgedType classType) const ;
334
334
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE
335
+ BridgedConformance getSpecializedConformance (BridgedConformance genericConformance,
336
+ BridgedASTType type,
337
+ BridgedSubstitutionMap substitutions) const ;
338
+ SWIFT_IMPORT_UNSAFE BRIDGED_INLINE
335
339
OptionalBridgedWitnessTable lookupWitnessTable (BridgedConformance conformance) const ;
336
340
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedWitnessTable createWitnessTable (BridgedLinkage linkage,
337
341
bool serialized,
Original file line number Diff line number Diff line change @@ -417,6 +417,16 @@ OptionalBridgedVTable BridgedPassContext::lookupSpecializedVTable(BridgedType cl
417
417
return {mod->lookUpSpecializedVTable (classType.unbridged ())};
418
418
}
419
419
420
+ BridgedConformance BridgedPassContext::getSpecializedConformance (
421
+ BridgedConformance genericConformance,
422
+ BridgedASTType type,
423
+ BridgedSubstitutionMap substitutions) const {
424
+ auto &ctxt = invocation->getPassManager ()->getModule ()->getASTContext ();
425
+ auto *genConf = llvm::cast<swift::NormalProtocolConformance>(genericConformance.unbridged ().getConcrete ());
426
+ auto *c = ctxt.getSpecializedConformance (type.unbridged (), genConf, substitutions.unbridged ());
427
+ return swift::ProtocolConformanceRef (c);
428
+ }
429
+
420
430
OptionalBridgedWitnessTable BridgedPassContext::lookupWitnessTable (BridgedConformance conformance) const {
421
431
swift::ProtocolConformanceRef ref = conformance.unbridged ();
422
432
if (!ref.isConcrete ()) {
You can’t perform that action at this time.
0 commit comments