@@ -139,6 +139,9 @@ RequirementMachine::RequirementMachine(RewriteContext &ctx)
139
139
RequirementMachineStepLimit = langOpts.RequirementMachineStepLimit ;
140
140
RequirementMachineDepthLimit = langOpts.RequirementMachineDepthLimit ;
141
141
Stats = ctx.getASTContext ().Stats ;
142
+
143
+ if (Stats)
144
+ ++Stats->getFrontendCounters ().NumRequirementMachines ;
142
145
}
143
146
144
147
RequirementMachine::~RequirementMachine () {}
@@ -147,19 +150,15 @@ RequirementMachine::~RequirementMachine() {}
147
150
// /
148
151
// / This must only be called exactly once, before any other operations are
149
152
// / performed on this requirement machine.
153
+ // /
154
+ // / Used by ASTContext::getOrCreateRequirementMachine().
150
155
void RequirementMachine::initWithGenericSignature (CanGenericSignature sig) {
151
156
Sig = sig;
152
157
Params.append (sig.getGenericParams ().begin (),
153
158
sig.getGenericParams ().end ());
154
159
155
160
PrettyStackTraceGenericSignature debugStack (" building rewrite system for" , sig);
156
161
157
- auto &ctx = Context.getASTContext ();
158
- auto *Stats = ctx.Stats ;
159
-
160
- if (Stats)
161
- ++Stats->getFrontendCounters ().NumRequirementMachines ;
162
-
163
162
FrontendStatsTracer tracer (Stats, " build-rewrite-system" );
164
163
165
164
if (Dump) {
@@ -189,15 +188,11 @@ void RequirementMachine::initWithGenericSignature(CanGenericSignature sig) {
189
188
// /
190
189
// / This must only be called exactly once, before any other operations are
191
190
// / performed on this requirement machine.
191
+ // /
192
+ // / Used by RequirementSignatureRequest.
192
193
void RequirementMachine::initWithProtocols (ArrayRef<const ProtocolDecl *> protos) {
193
194
Protos = protos;
194
195
195
- auto &ctx = Context.getASTContext ();
196
- auto *Stats = ctx.Stats ;
197
-
198
- if (Stats)
199
- ++Stats->getFrontendCounters ().NumRequirementMachines ;
200
-
201
196
FrontendStatsTracer tracer (Stats, " build-rewrite-system" );
202
197
203
198
if (Dump) {
@@ -225,18 +220,17 @@ void RequirementMachine::initWithProtocols(ArrayRef<const ProtocolDecl *> protos
225
220
}
226
221
227
222
// / Build a requirement machine from a set of generic parameters and
228
- // / (possibly non-canonical or non-minimal) structural requirements.
223
+ // / (possibly non-canonical or non-minimal) abstract requirements.
224
+ // /
225
+ // / This must only be called exactly once, before any other operations are
226
+ // / performed on this requirement machine.
227
+ // /
228
+ // / Used by AbstractGenericSignatureRequest.
229
229
void RequirementMachine::initWithAbstractRequirements (
230
230
ArrayRef<GenericTypeParamType *> genericParams,
231
231
ArrayRef<Requirement> requirements) {
232
232
Params.append (genericParams.begin (), genericParams.end ());
233
233
234
- auto &ctx = Context.getASTContext ();
235
- auto *Stats = ctx.Stats ;
236
-
237
- if (Stats)
238
- ++Stats->getFrontendCounters ().NumRequirementMachines ;
239
-
240
234
FrontendStatsTracer tracer (Stats, " build-rewrite-system" );
241
235
242
236
if (Dump) {
0 commit comments