[PATCH] D18775: NFC: make AtomicOrdering an enum class

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 8 15:16:39 PDT 2016


BTW, this is what i came up with, not sure if anyone has a better way

inline hash_code hash_value(const AtomicOrdering &AO) {
  return static_cast<typename
std::underlying_type<AtomicOrdering>::type>(AO);
}



On Fri, Apr 8, 2016 at 3:03 PM, Daniel Berlin <dberlin at dberlin.org> wrote:

> dberlin added a subscriber: dberlin.
> dberlin added a comment.
>
> This breaks the ability to hash them :)
>
> IE, i have a hash function that does:
> return hash_combine(A->getType(), A->getPointerOperand()->getType(),
>
>   A->getValueOperand()->getType(), A->isVolatile(),
>   A->getAlignment(), A->getOrdering(),
>   A->getSynchScope());
>
> now the hash on getOrdering fails with wonderful template messages.
>
> Can you define hash_value for it (see ADT/Hashing.h)?
>
> (The hash works on getSynchScope because it's not an enum class, just an
> enum)
>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D18775
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160408/09161c48/attachment.html>


More information about the llvm-commits mailing list