File tree Expand file tree Collapse file tree 6 files changed +34
-23
lines changed Expand file tree Collapse file tree 6 files changed +34
-23
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,6 @@ namespace swift {
112
112
class TupleTypeElt ;
113
113
class EnumElementDecl ;
114
114
class ProtocolDecl ;
115
- class RequirementMachine ;
116
115
class SubstitutableType ;
117
116
class SourceManager ;
118
117
class ValueDecl ;
@@ -135,6 +134,10 @@ namespace namelookup {
135
134
class ImportCache ;
136
135
}
137
136
137
+ namespace rewriting {
138
+ class RequirementMachine ;
139
+ }
140
+
138
141
namespace syntax {
139
142
class SyntaxArena ;
140
143
}
@@ -1160,7 +1163,7 @@ class ASTContext final {
1160
1163
1161
1164
// / Retrieve or create a term rewriting system for answering queries on
1162
1165
// / type parameters written against the given generic signature.
1163
- RequirementMachine *getOrCreateRequirementMachine (
1166
+ rewriting:: RequirementMachine *getOrCreateRequirementMachine (
1164
1167
CanGenericSignature sig);
1165
1168
1166
1169
// / Retrieve a generic signature with a single unconstrained type parameter,
Original file line number Diff line number Diff line change @@ -33,10 +33,13 @@ namespace swift {
33
33
class GenericSignatureBuilder ;
34
34
class ProtocolConformanceRef ;
35
35
class ProtocolType ;
36
- class RequirementMachine ;
37
36
class SubstitutionMap ;
38
37
class GenericEnvironment ;
39
38
39
+ namespace rewriting {
40
+ class RequirementMachine ;
41
+ }
42
+
40
43
// / An access path used to find a particular protocol conformance within
41
44
// / a generic signature.
42
45
// /
@@ -82,7 +85,7 @@ class ConformanceAccessPath {
82
85
83
86
friend class GenericSignatureImpl ;
84
87
friend class GenericSignatureBuilder ;
85
- friend class RequirementMachine ;
88
+ friend class rewriting :: RequirementMachine;
86
89
87
90
public:
88
91
typedef const Entry *const_iterator;
@@ -320,7 +323,7 @@ class alignas(1 << TypeAlignInBits) GenericSignatureImpl final
320
323
GenericSignatureBuilder *getGenericSignatureBuilder () const ;
321
324
322
325
// / Retrieve the requirement machine for the given generic signature.
323
- RequirementMachine *getRequirementMachine () const ;
326
+ rewriting:: RequirementMachine *getRequirementMachine () const ;
324
327
325
328
// / Collects a set of requirements on a type parameter. Used by
326
329
// / GenericEnvironment for building archetypes.
Original file line number Diff line number Diff line change @@ -420,7 +420,8 @@ struct ASTContext::Implementation {
420
420
GenericSignatureBuilders;
421
421
422
422
// / Stored requirement machines for canonical generic signatures.
423
- llvm::DenseMap<GenericSignature, std::unique_ptr<RequirementMachine>>
423
+ llvm::DenseMap<GenericSignature,
424
+ std::unique_ptr<rewriting::RequirementMachine>>
424
425
RequirementMachines;
425
426
426
427
// / The set of function types.
@@ -1892,8 +1893,8 @@ GenericSignatureBuilder *ASTContext::getOrCreateGenericSignatureBuilder(
1892
1893
return builder;
1893
1894
}
1894
1895
1895
- RequirementMachine *ASTContext::getOrCreateRequirementMachine (
1896
- CanGenericSignature sig) {
1896
+ rewriting:: RequirementMachine *
1897
+ ASTContext::getOrCreateRequirementMachine ( CanGenericSignature sig) {
1897
1898
assert (!sig.hasTypeVariable ());
1898
1899
1899
1900
auto &rewriteCtx = getImpl ().TheRewriteContext ;
@@ -1917,7 +1918,7 @@ RequirementMachine *ASTContext::getOrCreateRequirementMachine(
1917
1918
return machine;
1918
1919
}
1919
1920
1920
- auto *machine = new RequirementMachine (*rewriteCtx);
1921
+ auto *machine = new rewriting:: RequirementMachine (*rewriteCtx);
1921
1922
1922
1923
// Store this requirement machine before adding the signature,
1923
1924
// to catch re-entrant construction via addGenericSignature()
Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ GenericSignatureImpl::getGenericSignatureBuilder() const {
191
191
CanGenericSignature (this ));
192
192
}
193
193
194
- RequirementMachine *
194
+ rewriting:: RequirementMachine *
195
195
GenericSignatureImpl::getRequirementMachine () const {
196
196
// The requirement machine is associated with the canonical signature.
197
197
if (!isCanonical ())
Original file line number Diff line number Diff line change @@ -21,10 +21,6 @@ class raw_ostream;
21
21
22
22
namespace swift {
23
23
24
- namespace rewriting {
25
- class RewriteContext ;
26
- }
27
-
28
24
class ASTContext ;
29
25
class AssociatedTypeDecl ;
30
26
class CanType ;
@@ -34,17 +30,20 @@ class ProtocolDecl;
34
30
class Requirement ;
35
31
class Type ;
36
32
33
+ namespace rewriting {
34
+ class RewriteContext ;
35
+
37
36
// / Wraps a rewrite system with higher-level operations in terms of
38
37
// / generic signatures and interface types.
39
38
class RequirementMachine final {
40
- friend class ASTContext ;
39
+ friend class swift :: ASTContext;
41
40
42
41
struct Implementation ;
43
42
44
43
ASTContext &Context;
45
44
Implementation *Impl;
46
45
47
- explicit RequirementMachine (rewriting:: RewriteContext &rewriteCtx);
46
+ explicit RequirementMachine (RewriteContext &rewriteCtx);
48
47
49
48
RequirementMachine (const RequirementMachine &) = delete ;
50
49
RequirementMachine (RequirementMachine &&) = delete ;
@@ -82,6 +81,8 @@ class RequirementMachine final {
82
81
void dump (llvm::raw_ostream &out) const ;
83
82
};
84
83
84
+ } // end namespace rewriting
85
+
85
86
} // end namespace swift
86
87
87
88
#endif
Original file line number Diff line number Diff line change 26
26
27
27
namespace swift {
28
28
29
+ namespace rewriting {
30
+
29
31
// / We use the PIMPL pattern to avoid creeping header dependencies.
30
32
struct RequirementMachine ::Implementation {
31
- rewriting:: RewriteContext &Context;
32
- rewriting:: RewriteSystem System;
33
- rewriting:: PropertyMap Map;
33
+ RewriteContext &Context;
34
+ RewriteSystem System;
35
+ PropertyMap Map;
34
36
CanGenericSignature Sig;
35
37
bool Complete = false ;
36
38
@@ -45,17 +47,18 @@ struct RequirementMachine::Implementation {
45
47
std::vector<std::pair<CanType, ConformanceAccessPath>>
46
48
CurrentConformanceAccessPaths;
47
49
48
- explicit Implementation (rewriting:: RewriteContext &ctx)
50
+ explicit Implementation (RewriteContext &ctx)
49
51
: Context(ctx),
50
52
System(Context),
51
53
Map(Context, System.getProtocols()) {}
52
- void verify (const rewriting:: MutableTerm &term);
54
+ void verify (const MutableTerm &term);
53
55
void dump (llvm::raw_ostream &out);
54
56
55
- rewriting::MutableTerm getLongestValidPrefix (
56
- const rewriting::MutableTerm &term);
57
+ MutableTerm getLongestValidPrefix (const MutableTerm &term);
57
58
};
58
59
59
60
}
60
61
62
+ }
63
+
61
64
#endif
You can’t perform that action at this time.
0 commit comments