Skip to content

Commit d0bad4c

Browse files
committed
[cxx-interop] Avoid cycles in ClangTypeExplicitSafety requests
rdar://163511959
1 parent fc168a0 commit d0bad4c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8789,11 +8789,13 @@ CustomRefCountingOperationResult CustomRefCountingOperation::evaluate(
87898789

87908790
/// Check whether the given Clang type involves an unsafe type.
87918791
static bool hasUnsafeType(Evaluator &evaluator, clang::QualType clangType) {
8792-
8793-
auto safety =
8794-
evaluateOrDefault(evaluator, ClangTypeExplicitSafety({clangType}),
8795-
ExplicitSafety::Unspecified);
8796-
return safety == ExplicitSafety::Unsafe;
8792+
auto req = ClangTypeExplicitSafety({clangType});
8793+
if (evaluator.hasActiveRequest(req))
8794+
// If there is a cycle in a type, assume ExplicitSafety is Unspecified,
8795+
// i.e., not unsafe:
8796+
return false;
8797+
return evaluateOrDefault(evaluator, req, ExplicitSafety::Unspecified) ==
8798+
ExplicitSafety::Unsafe;
87978799
}
87988800

87998801
ExplicitSafety

0 commit comments

Comments
 (0)