================
@@ -111,6 +109,28 @@ void *Decl::operator new(std::size_t Size, const 
ASTContext &Ctx,
   return ::operator new(Size + Extra, Ctx);
 }
 
+GlobalDeclID Decl::getGlobalID() const {
+  if (!isFromASTFile())
+    return GlobalDeclID();
+  uint64_t ID = *((const uint64_t *)this - 1);
----------------
ChuanqiXu9 wrote:

Previously, for deserialized declaration, clang would apply an additional 64 
bits for it. And clang would store the global declaration ID at the lower 32 
bits and store the module index at the higher 32 bits.

And after this patch, we extend the global declaration ID to 64 bits and I 
don't want to apply additional spaces. So I decided to use the lower 48 bits to 
store the declaration ID and the higher 16 bits to store the module index.

I added a comment here to clarify that.

And as I mentioned in the message, it looks like there are relationships 
between module index and module file index (the upper 16 bits of the new 
declaration ID). But on the one hand, I want to make the patch as simple as 
possible to make it land faster. On the other hand, it looks like 16 bits is 
enough for both module index and module file index. And we can't get any 
improvements by merge it. So I just leave it as is.

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

Reply via email to