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 {
3333class GenericSignatureBuilder ;
3434class ProtocolConformanceRef ;
3535class ProtocolType ;
36+ class RequirementMachine ;
3637class SubstitutionMap ;
3738class GenericEnvironment ;
3839
@@ -303,6 +304,9 @@ class alignas(1 << TypeAlignInBits) GenericSignatureImpl final
303304 // / Retrieve the generic signature builder for the given generic signature.
304305 GenericSignatureBuilder *getGenericSignatureBuilder () const ;
305306
307+ // / Retrieve the requirement machine for the given generic signature.
308+ RequirementMachine *getRequirementMachine () const ;
309+
306310 // / Returns the generic environment that provides fresh contextual types
307311 // / (archetypes) that correspond to the interface types in this generic
308312 // / signature.
Original file line number Diff line number Diff line change 2222#include " swift/AST/GenericEnvironment.h"
2323#include " swift/AST/Module.h"
2424#include " swift/AST/PrettyStackTrace.h"
25+ #include " swift/AST/RequirementMachine.h"
2526#include " swift/AST/Types.h"
2627#include " swift/Basic/STLExtras.h"
2728#include < functional>
@@ -166,6 +167,17 @@ GenericSignatureImpl::getGenericSignatureBuilder() const {
166167 CanGenericSignature (this ));
167168}
168169
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+
169181bool GenericSignatureImpl::isEqual (GenericSignature Other) const {
170182 return getCanonicalSignature () == Other.getCanonicalSignature ();
171183}
You can’t perform that action at this time.
0 commit comments