@@ -70,7 +70,7 @@ class TypeDependentOperandCollector {
70
70
}
71
71
72
72
void addTo (SmallVectorImpl<SILValue> &typeDependentOperands,
73
- SILFunction &f );
73
+ SILInstructionContext context );
74
74
};
75
75
76
76
}
@@ -113,15 +113,18 @@ void TypeDependentOperandCollector::collect(SubstitutionMap subs) {
113
113
// / Given that we've collected a set of type dependencies, add operands
114
114
// / for those dependencies to the given vector.
115
115
void TypeDependentOperandCollector::addTo (SmallVectorImpl<SILValue> &operands,
116
- SILFunction &F ) {
116
+ SILInstructionContext context ) {
117
117
for (GenericEnvironment *genericEnv : genericEnvs) {
118
- SILValue def = F.getModule ().getLocalGenericEnvironmentDef (genericEnv, &F);
119
- assert (def->getFunction () == &F &&
118
+ SILValue def = context.getModule ().getLocalGenericEnvironmentDef (
119
+ genericEnv, context.getFunction ());
120
+ assert (def->getFunction () == context.getFunction () &&
120
121
" def of local environment is in wrong function" );
121
122
operands.push_back (def);
122
123
}
123
- if (hasDynamicSelf)
124
- operands.push_back (F.getDynamicSelfMetadata ());
124
+ if (hasDynamicSelf) {
125
+ assert (context.getFunction ());
126
+ operands.push_back (context.getFunction ()->getDynamicSelfMetadata ());
127
+ }
125
128
}
126
129
127
130
// / Collects all root local archetypes from a type and a substitution list, and
@@ -130,12 +133,22 @@ void TypeDependentOperandCollector::addTo(SmallVectorImpl<SILValue> &operands,
130
133
// / of corresponding operands for the instruction being formed, because we need
131
134
// / to reserve enough memory for these operands.
132
135
template <class ... Sources>
133
- static void collectTypeDependentOperands (
134
- SmallVectorImpl<SILValue> &typeDependentOperands,
135
- SILFunction &F, Sources &&... sources) {
136
+ static void
137
+ collectTypeDependentOperands (SmallVectorImpl<SILValue> &typeDependentOperands,
138
+ SILInstructionContext context,
139
+ Sources &&...sources) {
136
140
TypeDependentOperandCollector collector;
137
141
collector.collectAll (std::forward<Sources>(sources)...);
138
- collector.addTo (typeDependentOperands, F);
142
+ collector.addTo (typeDependentOperands, context);
143
+ }
144
+
145
+ template <class ... Sources>
146
+ static void
147
+ collectTypeDependentOperands (SmallVectorImpl<SILValue> &typeDependentOperands,
148
+ SILFunction &function, Sources &&...sources) {
149
+ collectTypeDependentOperands (typeDependentOperands,
150
+ SILInstructionContext::forFunction (function),
151
+ std::forward<Sources>(sources)...);
139
152
}
140
153
141
154
// ===----------------------------------------------------------------------===//
@@ -2493,7 +2506,7 @@ OpenPackElementInst *OpenPackElementInst::create(
2493
2506
PackType *packSubstitution) {
2494
2507
collector.collect (packSubstitution->getCanonicalType ());
2495
2508
});
2496
- collector.addTo (typeDependentOperands, F );
2509
+ collector.addTo (typeDependentOperands, SILInstructionContext::forFunction (F) );
2497
2510
2498
2511
SILType type = SILType::getSILTokenType (F.getASTContext ());
2499
2512
0 commit comments