[llvm] r261268 - [ADT] Be less clever when using a nonce type for disambiguation.

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 14:48:20 PST 2016


On Thu, Feb 18, 2016 at 2:07 PM Jordan Rose via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: jrose
> Date: Thu Feb 18 16:03:23 2016
> New Revision: 261268
>
> URL: http://llvm.org/viewvc/llvm-project?rev=261268&view=rev
> Log:
> [ADT] Be less clever when using a nonce type for disambiguation.
>
> Old compilers don't like constexpr, but we're only going to use this in one
> place anyway: this file. Everyone else should go through
> PointerLikeTypeTraits.
>
> Update to r261259.
>
> Modified:
>     llvm/trunk/include/llvm/ADT/PointerEmbeddedInt.h
>
> Modified: llvm/trunk/include/llvm/ADT/PointerEmbeddedInt.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PointerEmbeddedInt.h?rev=261268&r1=261267&r2=261268&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/PointerEmbeddedInt.h (original)
> +++ llvm/trunk/include/llvm/ADT/PointerEmbeddedInt.h Thu Feb 18 16:03:23
> 2016
> @@ -45,7 +45,9 @@ class PointerEmbeddedInt {
>      Mask = static_cast<uintptr_t>(-1) << Bits
>    };
>
> -  static constexpr const struct RawValueTag {} RawValue = RawValueTag();
> +  struct RawValueTag {
> +    explicit RawValueTag() = default;
> +  };
>

Why not just "struct RawValueTag {};"? Not sure what all the explicit stuff
is buying you here...


>
>    friend class PointerLikeTypeTraits<PointerEmbeddedInt>;
>
> @@ -86,10 +88,10 @@ public:
>      return reinterpret_cast<void *>(P.Value);
>    }
>    static inline T getFromVoidPointer(void *P) {
> -    return T(reinterpret_cast<uintptr_t>(P), T::RawValue);
> +    return T(reinterpret_cast<uintptr_t>(P), typename T::RawValueTag());
>    }
>    static inline T getFromVoidPointer(const void *P) {
> -    return T(reinterpret_cast<uintptr_t>(P), T::RawValue);
> +    return T(reinterpret_cast<uintptr_t>(P), typename T::RawValueTag());
>    }
>
>    enum { NumLowBitsAvailable = T::Shift };
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160218/5309b6e1/attachment.html>


More information about the llvm-commits mailing list