diff options
Diffstat (limited to 'include/llvm/ADT/PointerIntPair.h')
-rw-r--r-- | include/llvm/ADT/PointerIntPair.h | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/include/llvm/ADT/PointerIntPair.h b/include/llvm/ADT/PointerIntPair.h index 6d1b53a90ad2..24a2bb67a36e 100644 --- a/include/llvm/ADT/PointerIntPair.h +++ b/include/llvm/ADT/PointerIntPair.h @@ -1,9 +1,8 @@ //===- llvm/ADT/PointerIntPair.h - Pair for pointer and int -----*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -15,6 +14,7 @@ #define LLVM_ADT_POINTERINTPAIR_H #include "llvm/Support/PointerLikeTypeTraits.h" +#include "llvm/Support/type_traits.h" #include <cassert> #include <cstdint> #include <limits> @@ -126,6 +126,19 @@ public: } }; +// Specialize is_trivially_copyable to avoid limitation of llvm::is_trivially_copyable +// when compiled with gcc 4.9. +template <typename PointerTy, unsigned IntBits, typename IntType, + typename PtrTraits, + typename Info> +struct is_trivially_copyable<PointerIntPair<PointerTy, IntBits, IntType, PtrTraits, Info>> : std::true_type { +#ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE + static_assert(std::is_trivially_copyable<PointerIntPair<PointerTy, IntBits, IntType, PtrTraits, Info>>::value, + "inconsistent behavior between llvm:: and std:: implementation of is_trivially_copyable"); +#endif +}; + + template <typename PointerT, unsigned IntBits, typename PtrTraits> struct PointerIntPairInfo { static_assert(PtrTraits::NumLowBitsAvailable < @@ -176,12 +189,6 @@ struct PointerIntPairInfo { } }; -template <typename T> struct isPodLike; -template <typename PointerTy, unsigned IntBits, typename IntType> -struct isPodLike<PointerIntPair<PointerTy, IntBits, IntType>> { - static const bool value = true; -}; - // Provide specialization of DenseMapInfo for PointerIntPair. template <typename PointerTy, unsigned IntBits, typename IntType> struct DenseMapInfo<PointerIntPair<PointerTy, IntBits, IntType>> { |