[clang] [Modules] Delay deserialization of preferred_name attribute at r… (PR #122726)
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 14 23:43:19 PST 2025
https://github.com/ChuanqiXu9 commented:
Thanks.
(1) Hardcoding is generally not good. And even if we have to, e.g., (we don't have an automatic mechanism to check if we need to defer an attribute), let's avoid hardcoding in both reader side and writer side. We can make this by adding a new bit in the record of attribute to indicate if we need to delay it or not in the reader side generally.
(2) Then I think we can keep the signature of `readAttr` as is, where it will always skip the check for the delay bit and always try to read it. Then we can add a `readOrDeferFor(Decl *D)` method as you did. The `readOrDeferFor` will try to read the `deferring` bits directly and if it is true, it will record the length `skipCount` and `D` to `PendingDeferredAttributes` . Otherwise, it will call `readAttr`. I think it is more clear.
https://github.com/llvm/llvm-project/pull/122726
More information about the cfe-commits
mailing list