File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ namespace swift {
33
33
class GenericSignatureBuilder ;
34
34
class ProtocolConformanceRef ;
35
35
class ProtocolType ;
36
+ class RequirementMachine ;
36
37
class SubstitutionMap ;
37
38
class GenericEnvironment ;
38
39
@@ -303,6 +304,9 @@ class alignas(1 << TypeAlignInBits) GenericSignatureImpl final
303
304
// / Retrieve the generic signature builder for the given generic signature.
304
305
GenericSignatureBuilder *getGenericSignatureBuilder () const ;
305
306
307
+ // / Retrieve the requirement machine for the given generic signature.
308
+ RequirementMachine *getRequirementMachine () const ;
309
+
306
310
// / Returns the generic environment that provides fresh contextual types
307
311
// / (archetypes) that correspond to the interface types in this generic
308
312
// / signature.
Original file line number Diff line number Diff line change 22
22
#include " swift/AST/GenericEnvironment.h"
23
23
#include " swift/AST/Module.h"
24
24
#include " swift/AST/PrettyStackTrace.h"
25
+ #include " swift/AST/RequirementMachine.h"
25
26
#include " swift/AST/Types.h"
26
27
#include " swift/Basic/STLExtras.h"
27
28
#include < functional>
@@ -166,6 +167,17 @@ GenericSignatureImpl::getGenericSignatureBuilder() const {
166
167
CanGenericSignature (this ));
167
168
}
168
169
170
+ RequirementMachine *
171
+ GenericSignatureImpl::getRequirementMachine () const {
172
+ // The requirement machine is associated with the canonical signature.
173
+ if (!isCanonical ())
174
+ return getCanonicalSignature ()->getRequirementMachine ();
175
+
176
+ // Requirement machines are stored on the ASTContext.
177
+ return getASTContext ().getOrCreateRequirementMachine (
178
+ CanGenericSignature (this ));
179
+ }
180
+
169
181
bool GenericSignatureImpl::isEqual (GenericSignature Other) const {
170
182
return getCanonicalSignature () == Other.getCanonicalSignature ();
171
183
}
You can’t perform that action at this time.
0 commit comments