================
@@ -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); }
----------------
hahnjo wrote:
The review related to `ODRHash` is this one: https://reviews.llvm.org/D153003
In short, my understanding is that `ODRHash` gives the following guarantee: If
the hashes are different, there is guaranteed to be a ODR violation. In the
other direction, if two hashes are the same, the declarations have to be
compared in more detail, ie there may or may not be an ODR violation.
For the specializations, we need the opposite: If two template arguments are
semantically the same (*), they *must* hash to the same value or otherwise we
will not find the correct bucket. On the other hand, two different
specialization arguments may have the same hash, that's fine for the map data
structure.
Now the additional caveat (*) is that "semantically the same" is not the same
congruence as "no ODR violation". In https://reviews.llvm.org/D153003 we
discuss `using` declarations, but IIRC it's also possible to construct
problematic cases with (nested) namespaces, top-level `::` prefixes, and
template template parameters. Taken together, my conclusion from the discussion
above is that `ODRHash` is simply not the right method to find template
specialization parameters in a map.
https://github.com/llvm/llvm-project/pull/76774
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits