@@ -154,13 +154,15 @@ class AnyRequestBase {
154
154
return *static_cast <const Derived *>(this );
155
155
}
156
156
157
+ const void *getRawStorage () const { return asDerived ().getRawStorage (); }
158
+
157
159
public:
158
160
// / Cast to a specific (known) type.
159
161
template <typename Request>
160
162
const Request &castTo () const {
161
163
assert (getVTable ()->typeID == TypeID<Request>::value &&
162
164
" Wrong type in cast" );
163
- return *static_cast <const Request *>(asDerived (). getRawStorage ());
165
+ return *static_cast <const Request *>(getRawStorage ());
164
166
}
165
167
166
168
// / Try casting to a specific (known) type, returning \c nullptr on
@@ -170,26 +172,27 @@ class AnyRequestBase {
170
172
if (getVTable ()->typeID != TypeID<Request>::value)
171
173
return nullptr ;
172
174
173
- return static_cast <const Request *>(asDerived (). getRawStorage ());
175
+ return static_cast <const Request *>(getRawStorage ());
174
176
}
175
177
176
178
// / Diagnose a cycle detected for this request.
177
179
void diagnoseCycle (DiagnosticEngine &diags) const {
178
- getVTable ()->diagnoseCycle (asDerived (). getRawStorage (), diags);
180
+ getVTable ()->diagnoseCycle (getRawStorage (), diags);
179
181
}
180
182
181
183
// / Note that this request is part of a cycle.
182
184
void noteCycleStep (DiagnosticEngine &diags) const {
183
- getVTable ()->noteCycleStep (asDerived (). getRawStorage (), diags);
185
+ getVTable ()->noteCycleStep (getRawStorage (), diags);
184
186
}
185
187
186
188
// / Retrieve the nearest source location to which this request applies.
187
189
SourceLoc getNearestLoc () const {
188
- return getVTable ()->getNearestLoc (asDerived (). getRawStorage ());
190
+ return getVTable ()->getNearestLoc (getRawStorage ());
189
191
}
190
192
191
193
// / Compare two instances for equality.
192
- friend bool operator ==(const Derived &lhs, const Derived &rhs) {
194
+ friend bool operator ==(const AnyRequestBase<Derived> &lhs,
195
+ const AnyRequestBase<Derived> &rhs) {
193
196
// If the storage kinds don't match, we're done.
194
197
if (lhs.getStorageKind () != rhs.getStorageKind ())
195
198
return false ;
@@ -210,7 +213,7 @@ class AnyRequestBase {
210
213
return !(lhs == rhs);
211
214
}
212
215
213
- friend hash_code hash_value (const Derived &req) {
216
+ friend hash_code hash_value (const AnyRequestBase< Derived> &req) {
214
217
// If there's no storage, return a trivial hash value.
215
218
if (!req.hasStorage ())
216
219
return 1 ;
@@ -219,7 +222,8 @@ class AnyRequestBase {
219
222
return hashForHolder (req.getVTable ()->typeID , reqHash);
220
223
}
221
224
222
- friend void simple_display (llvm::raw_ostream &out, const Derived &req) {
225
+ friend void simple_display (llvm::raw_ostream &out,
226
+ const AnyRequestBase<Derived> &req) {
223
227
req.getVTable ()->simpleDisplay (req.getRawStorage (), out);
224
228
}
225
229
};
@@ -240,7 +244,9 @@ class AnyRequestBase {
240
244
// / void noteCycleStep(DiagnosticEngine &diags) const;
241
245
// /
242
246
class ActiveRequest final : public AnyRequestBase<ActiveRequest> {
247
+ template <typename T>
243
248
friend class AnyRequestBase ;
249
+
244
250
friend class AnyRequest ;
245
251
friend llvm::DenseMapInfo<ActiveRequest>;
246
252
@@ -280,7 +286,9 @@ class ActiveRequest final : public AnyRequestBase<ActiveRequest> {
280
286
// / void noteCycleStep(DiagnosticEngine &diags) const;
281
287
// /
282
288
class AnyRequest final : public AnyRequestBase<AnyRequest> {
289
+ template <typename T>
283
290
friend class AnyRequestBase ;
291
+
284
292
friend llvm::DenseMapInfo<AnyRequest>;
285
293
286
294
// / Pointer to the request on the heap.
0 commit comments