[Lldb-commits] [lldb] [LLDB] Detect cycles during Type resolution (PR #200304)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Fri May 29 12:46:50 PDT 2026


================
@@ -584,6 +585,14 @@ bool Type::WriteToMemory(ExecutionContext *exe_ctx, lldb::addr_t addr,
 const Declaration &Type::GetDeclaration() const { return m_decl; }
 
 bool Type::ResolveCompilerType(ResolveState compiler_type_resolve_state) {
+  if (m_resolving_compiler_type) {
+    LLDB_LOG(GetLog(LLDBLog::Symbols),
+             "Cycle detected while resolving type {0:x} ({1})", GetID(),
+             m_name.AsCString("<anonymous>"));
+    return false;
+  }
+  llvm::SaveAndRestore<bool> guard(m_resolving_compiler_type, true);
----------------
bulbazord wrote:

Right, I don't have a good picture of how `Type` is used in concurrent contexts... I'd say this change can exist without needing to address making `Type` more thread-safe.

https://github.com/llvm/llvm-project/pull/200304


More information about the lldb-commits mailing list