[clang] [serialization] No transitive type change (PR #92511)

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 20 03:14:56 PDT 2024


================
@@ -6659,13 +6655,22 @@ void ASTWriter::MacroRead(serialization::MacroID ID, MacroInfo *MI) {
 }
 
 void ASTWriter::TypeRead(TypeIdx Idx, QualType T) {
-  // Always take the highest-numbered type index. This copes with an interesting
+  // Always take the type index that comes in later module files.
+  // This copes with an interesting
   // case for chained AST writing where we schedule writing the type and then,
   // later, deserialize the type from another AST. In this case, we want to
-  // keep the higher-numbered entry so that we can properly write it out to
+  // keep the just writing entry so that we can properly write it out to
   // the AST file.
   TypeIdx &StoredIdx = TypeIdxs[T];
-  if (Idx.getIndex() >= StoredIdx.getIndex())
+
+  // Ignore it if the type comes from the current being written module file.
----------------
ilya-biryukov wrote:

Thanks for the clarifications! I suggest to capture it in a comment like this:

```cpp
// Since the current module file being written logically has the highest index.
```
(I believe you wanted to do something along those lines too, but the comment in the commit isn't complete)

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


More information about the cfe-commits mailing list