File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,34 @@ static bool canSkipCircularityCheck(NominalTypeDecl *decl) {
233
233
return decl->hasClangNode () || decl->wasDeserialized ();
234
234
}
235
235
236
+ bool
237
+ HasCircularInheritedProtocolsRequest::evaluate (Evaluator &evaluator,
238
+ ProtocolDecl *decl) const {
239
+ if (canSkipCircularityCheck (decl))
240
+ return false ;
241
+
242
+ bool anyObject = false ;
243
+ auto inherited = getDirectlyInheritedNominalTypeDecls (decl, anyObject);
244
+ for (auto &found : inherited) {
245
+ auto *protoDecl = dyn_cast<ProtocolDecl>(found.Item );
246
+ if (!protoDecl)
247
+ continue ;
248
+
249
+ // If we have a cycle, handle it and return true.
250
+ auto result = evaluator (HasCircularInheritedProtocolsRequest{protoDecl});
251
+ if (!result) {
252
+ using Error = CyclicalRequestError<HasCircularInheritedProtocolsRequest>;
253
+ llvm::handleAllErrors (result.takeError (), [](const Error &E) {});
254
+ return true ;
255
+ }
256
+
257
+ // If the underlying request handled a cycle and returned true, bail.
258
+ if (*result)
259
+ return true ;
260
+ }
261
+ return false ;
262
+ }
263
+
236
264
bool
237
265
HasCircularRawValueRequest::evaluate (Evaluator &evaluator,
238
266
EnumDecl *decl) const {
You can’t perform that action at this time.
0 commit comments