[Lldb-commits] [lldb] [lldb] Fix mod-while-iteration in IRForTarget (PR #203035)

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 10 09:17:32 PDT 2026


================
@@ -684,14 +687,17 @@ bool IRForTarget::RewriteObjCConstStrings() {
       if (!cstr_array)
         cstr_global = nullptr;
 
-      if (!RewriteObjCConstString(nsstring_global, cstr_global)) {
-        LLDB_LOG(log, "Error rewriting the constant string");
-
-        // We don't print an error message here because RewriteObjCConstString
-        // has done so for us.
+      // Queue up replacing the string as we are currently iterating
+      // over the module.
+      nsstring_to_cstr_list.emplace_back(nsstring_global, cstr_global);
+    }
+  }
 
-        return false;
-      }
+  for (const auto &nsstring_and_cstr : nsstring_to_cstr_list) {
+    auto [nsstring_global, cstr_global] = nsstring_and_cstr;
----------------
kastiglione wrote:

```suggestion
  for (auto [nsstring_global, cstr_global] : nsstring_to_cstr_list) {
```

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


More information about the lldb-commits mailing list