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 {
7474 return _bridged. lookupSpecializedVTable ( classType. bridged) . vTable
7575 }
7676
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+
7785 func notifyNewFunction( function: Function , derivedFrom: Function ) {
7886 _bridged. addFunctionToPassManagerWorklist ( function. bridged, derivedFrom. bridged)
7987 }
Original file line number Diff line number Diff line change @@ -332,6 +332,10 @@ struct BridgedPassContext {
332332 SWIFT_IMPORT_UNSAFE BRIDGED_INLINE
333333 OptionalBridgedVTable lookupSpecializedVTable (BridgedType classType) const ;
334334 SWIFT_IMPORT_UNSAFE BRIDGED_INLINE
335+ BridgedConformance getSpecializedConformance (BridgedConformance genericConformance,
336+ BridgedASTType type,
337+ BridgedSubstitutionMap substitutions) const ;
338+ SWIFT_IMPORT_UNSAFE BRIDGED_INLINE
335339 OptionalBridgedWitnessTable lookupWitnessTable (BridgedConformance conformance) const ;
336340 SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedWitnessTable createWitnessTable (BridgedLinkage linkage,
337341 bool serialized,
Original file line number Diff line number Diff line change @@ -417,6 +417,16 @@ OptionalBridgedVTable BridgedPassContext::lookupSpecializedVTable(BridgedType cl
417417 return {mod->lookUpSpecializedVTable (classType.unbridged ())};
418418}
419419
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+
420430OptionalBridgedWitnessTable BridgedPassContext::lookupWitnessTable (BridgedConformance conformance) const {
421431 swift::ProtocolConformanceRef ref = conformance.unbridged ();
422432 if (!ref.isConcrete ()) {
You can’t perform that action at this time.
0 commit comments