[llvm] [LLVM][ADT] Convert llvm::hash_code to unsigned explicitly in DenseMapInfo (PR #77743)
Andrei Golubev via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 11 04:50:01 PST 2024
andrey-golubev wrote:
> Shouldn't this return `size_t` instead maybe? Why is the implicit narrowing OK here?
I agree but I think the `unsigned` return type is [by design](https://github.com/llvm/llvm-project/blob/b7770befee37feca3d732d6daf9513c62f75c5f0/llvm/include/llvm/ADT/DenseMapInfo.h#L53) as the "main" template specialization expects the `unsigned` value ([`unsigned long long` specialization](https://github.com/llvm/llvm-project/blob/b7770befee37feca3d732d6daf9513c62f75c5f0/llvm/include/llvm/ADT/DenseMapInfo.h#L154) seems like a noteworthy candidate as well).
between changing the type (~signature) everywhere and doing the explicit thing for the case I picked the latter.
this problem only appeared in our project due to this specialization participating in some MLIR code, would've gone completely unnoticed otherwise.
https://github.com/llvm/llvm-project/pull/77743
More information about the llvm-commits
mailing list