[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


================
@@ -7392,27 +7388,28 @@ QualType ASTReader::GetType(TypeID ID) {
   return TypesLoaded[Index].withFastQualifiers(FastQuals);
 }
 
-QualType ASTReader::getLocalType(ModuleFile &F, unsigned LocalID) {
+QualType ASTReader::getLocalType(ModuleFile &F, TypeID LocalID) {
----------------
ilya-biryukov wrote:

The reason I feel `TypeID` is the "wrong" type here is because after reading the comments it feels that the module file index is always global. Keeping `TypeID` here is probably okay, but we should put this distinction into a comment somewhere (either a comment to `getLocalType` that says the TypeID we pass here is special because the index is relative to `F` or a comment to the `TypeID` itself that explains that module file index can be either global or relative to a module file).
I would probably vouch for putting this into `getLocalType` to avoid overloading the readers of the code that does not touch `getLocalType` with this special case (it seems to be quite limited anyway, we quickly read the value from the AST and convert it right away, same for writing)

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


More information about the cfe-commits mailing list