[clang] [Modules] Delay deserialization of preferred_name attribute at r… (PR #122726)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 16 00:47:17 PST 2025


================
@@ -10079,6 +10079,11 @@ void ASTReader::finishPendingActions() {
     }
     PendingDeducedVarTypes.clear();
 
+    // Load the delayed preferred name attributes.
+    for (unsigned I = 0; I != PendingDeferredAttributes.size(); ++I)
+      loadDeferredAttribute(PendingDeferredAttributes[I]);
+    PendingDeferredAttributes.clear();
----------------
ChuanqiXu9 wrote:

```suggestion
    // Load the delayed preferred name attributes.
    while (!PendingDeferredAttributes.empty()) {
      auto DeferredAttributes = std::move(PendingDeferredAttributes);
      for (DeferredAttribute &DA : DeferredAttribute)
        loadDeferredAttribute(DA);
    }
```

Technically, it is possible to update `PendingDeferredAttributes` during `loadDeferredAttribute()`.

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


More information about the cfe-commits mailing list