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

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 14 01:46:40 PST 2025


================
@@ -3159,13 +3175,27 @@ Attr *ASTRecordReader::readAttr() {
   return New;
 }
 
-/// Reads attributes from the current stream position.
-void ASTRecordReader::readAttributes(AttrVec &Attrs) {
+void ASTRecordReader::readAttributesImpl(AttrVec &Attrs, Decl *D) {
   for (unsigned I = 0, E = readInt(); I != E; ++I)
-    if (auto *A = readAttr())
+    if (auto *A = readAttr(D))
       Attrs.push_back(A);
 }
 
+Attr *ASTRecordReader::readAttr() { return readAttrImpl(nullptr); }
+
+/// Reads attributes from the current stream position.
+void ASTRecordReader::readAttributes(AttrVec &Attrs) {
+  readAttributesImpl(Attrs, nullptr);
+}
+
+/// Reads one attribute from the current stream position, advancing Idx.
+Attr *ASTRecordReader::readAttr(Decl *D) { return readAttrImpl(D); }
----------------
ilya-biryukov wrote:

The behavior of this funciton is drastically different from `readAttr`, could we use a different name and document that it delays reading of some attributes?

Same for `readAttributes`

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


More information about the cfe-commits mailing list