[clang] [Serialization] Load Specializations Lazily (1/2) (PR #76774)

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 8 00:14:24 PST 2024


================
@@ -1249,3 +1249,5 @@ void ODRHash::AddQualType(QualType T) {
 void ODRHash::AddBoolean(bool Value) {
   Bools.push_back(Value);
 }
+
+void ODRHash::AddInteger(unsigned Value) { ID.AddInteger(Value); }
----------------
vgvassilev wrote:

I guess the comment we are discussing is here: https://reviews.llvm.org/D154324#4524368 by @zygoloid:

"
...

For [D41416](https://reviews.llvm.org/D41416), ODR hashing may not be the best mechanism to hash the template arguments, unfortunately. ODR hashing is (or perhaps, should be) about determining whether two things are spelled the same way and have the same meaning (as required by the C++ ODR), whereas I think what you're looking for is whether they have the same meaning regardless of spelling. Maybe we can get away with reusing ODR hashing anyway, on the basis that any canonical, non-dependent template argument should have the same (invented) spelling in every translation unit, but I'm not certain that's true in all cases. There may still be cases where the canonical type includes some aspect of "whatever we saw first", in which case the ODR hash can differ across translation units for non-dependent, canonical template arguments that are spelled differently but have the same meaning, though I can't think of one off-hand.
```

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


More information about the cfe-commits mailing list