@@ -35,20 +35,27 @@ class SubstitutionMap;
35
35
// / signature and their dependent members.
36
36
class GenericSignatureWitnessIterator {
37
37
ArrayRef<Requirement> p;
38
-
38
+
39
+ void checkValid () const {
40
+ assert (!p.empty () &&
41
+ p.front ().getKind () == RequirementKind::WitnessMarker);
42
+ }
43
+
44
+ bool shouldSkip () const {
45
+ return (!p.empty () &&
46
+ p.front ().getKind () != RequirementKind::WitnessMarker);
47
+ }
48
+
39
49
public:
40
50
GenericSignatureWitnessIterator () = default ;
41
- GenericSignatureWitnessIterator (ArrayRef<Requirement> p)
42
- : p(p)
43
- {
44
- assert (p.empty () || p.front ().getKind () == RequirementKind::WitnessMarker);
51
+ GenericSignatureWitnessIterator (ArrayRef<Requirement> requirements)
52
+ : p(requirements) {
53
+ while (shouldSkip ()) { p = p.slice (1 ); }
45
54
}
46
55
47
56
GenericSignatureWitnessIterator &operator ++() {
48
- do {
49
- p = p.slice (1 );
50
- } while (!p.empty ()
51
- && p.front ().getKind () != RequirementKind::WitnessMarker);
57
+ checkValid ();
58
+ do { p = p.slice (1 ); } while (shouldSkip ());
52
59
return *this ;
53
60
}
54
61
@@ -59,12 +66,12 @@ class GenericSignatureWitnessIterator {
59
66
}
60
67
61
68
Type operator *() const {
62
- assert (p. front (). getKind () == RequirementKind::WitnessMarker );
69
+ checkValid ( );
63
70
return p.front ().getFirstType ();
64
71
}
65
72
66
73
Type operator ->() const {
67
- assert (p. front (). getKind () == RequirementKind::WitnessMarker );
74
+ checkValid ( );
68
75
return p.front ().getFirstType ();
69
76
}
70
77
@@ -162,7 +169,14 @@ class GenericSignature final : public llvm::FoldingSetNode,
162
169
return const_cast <GenericSignature *>(this )->getRequirementsBuffer ();
163
170
}
164
171
165
- // Only allow allocation by doing a placement new.
172
+ // / Check if the generic signature makes all generic parameters
173
+ // / concrete.
174
+ bool areAllParamsConcrete () const {
175
+ auto iter = getAllDependentTypes ();
176
+ return iter.begin () == iter.end ();
177
+ }
178
+
179
+ // / Only allow allocation by doing a placement new.
166
180
void *operator new (size_t Bytes, void *Mem) {
167
181
assert (Mem);
168
182
return Mem;
0 commit comments