================
@@ -3134,6 +3139,17 @@ Attr *ASTRecordReader::readAttr() {
   // Kind is stored as a 1-based integer because 0 is used to indicate a null
   // Attr pointer.
   auto Kind = static_cast<attr::Kind>(V - 1);
+  if (Kind == attr::PreferredName && D != nullptr) {
+    if (D != nullptr) {
----------------
ilya-biryukov wrote:

D is never null here, this if seems to be redundant.

Also, should we `assert` that `D != nullptr` when we deserialize 
`PreferredName`?
If we start deferring more attributes at some point, an assertion like this 
might not hold up, but it gives a good sanity check for preferred name 
specifically, because it should always be attached to some declaration.

https://github.com/llvm/llvm-project/pull/122726
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to