[llvm-branch-commits] [clang] [serialization] No transitive type change (PR #92511)

Ilya Biryukov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jun 19 09:55:29 PDT 2024


================
@@ -7650,6 +7647,16 @@ ModuleFile *ASTReader::getOwningModuleFile(GlobalDeclID ID) const {
   return &getModuleManager()[ModuleFileIndex - 1];
 }
 
+ModuleFile *ASTReader::getOwningModuleFile(TypeID ID) const {
+  if (ID < NUM_PREDEF_TYPE_IDS)
+    return nullptr;
+
+  uint64_t ModuleFileIndex = ID >> 32;
----------------
ilya-biryukov wrote:

NIT: maybe we could define helper functions to extract the `ModuleFileIndex`, type index and qualifiers from `TypeID`?

It would help the readability a bit (it's not too hard to remember how to do these operations, but it's a bit of code duplication and definitely makes reading a bit more involved)

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


More information about the llvm-branch-commits mailing list