mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-26 05:00:39 +00:00
[C++11] Replace LLVM-style type traits with C++11 standard ones.
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203242 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
122a970111
commit
c1dafe8dc3
@ -223,8 +223,8 @@ steps:
|
||||
[...]
|
||||
template <class T>
|
||||
static bool classof(const T *,
|
||||
::llvm::enable_if_c<
|
||||
::llvm::is_base_of<Foo, T>::value
|
||||
::std::enable_if<
|
||||
::std::is_base_of<Foo, T>::value
|
||||
>::type* = 0) { return true; }
|
||||
[...]
|
||||
};
|
||||
|
@ -977,7 +977,8 @@ class DenseMapIterator {
|
||||
friend class DenseMapIterator<KeyT, ValueT, KeyInfoT, true>;
|
||||
public:
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef typename conditional<IsConst, const Bucket, Bucket>::type value_type;
|
||||
typedef typename std::conditional<IsConst, const Bucket, Bucket>::type
|
||||
value_type;
|
||||
typedef value_type *pointer;
|
||||
typedef value_type &reference;
|
||||
typedef std::forward_iterator_tag iterator_category;
|
||||
|
@ -109,7 +109,8 @@ public:
|
||||
/// differing argument types even if they would implicit promote to a common
|
||||
/// type without changing the value.
|
||||
template <typename T>
|
||||
typename enable_if<is_integral_or_enum<T>, hash_code>::type hash_value(T value);
|
||||
typename std::enable_if<is_integral_or_enum<T>::value, hash_code>::type
|
||||
hash_value(T value);
|
||||
|
||||
/// \brief Compute a hash_code for a pointer's address.
|
||||
///
|
||||
@ -352,24 +353,24 @@ inline size_t get_execution_seed() {
|
||||
// and pointers, but there are platforms where it doesn't and we would like to
|
||||
// support user-defined types which happen to satisfy this property.
|
||||
template <typename T> struct is_hashable_data
|
||||
: integral_constant<bool, ((is_integral_or_enum<T>::value ||
|
||||
is_pointer<T>::value) &&
|
||||
64 % sizeof(T) == 0)> {};
|
||||
: std::integral_constant<bool, ((is_integral_or_enum<T>::value ||
|
||||
std::is_pointer<T>::value) &&
|
||||
64 % sizeof(T) == 0)> {};
|
||||
|
||||
// Special case std::pair to detect when both types are viable and when there
|
||||
// is no alignment-derived padding in the pair. This is a bit of a lie because
|
||||
// std::pair isn't truly POD, but it's close enough in all reasonable
|
||||
// implementations for our use case of hashing the underlying data.
|
||||
template <typename T, typename U> struct is_hashable_data<std::pair<T, U> >
|
||||
: integral_constant<bool, (is_hashable_data<T>::value &&
|
||||
is_hashable_data<U>::value &&
|
||||
(sizeof(T) + sizeof(U)) ==
|
||||
sizeof(std::pair<T, U>))> {};
|
||||
: std::integral_constant<bool, (is_hashable_data<T>::value &&
|
||||
is_hashable_data<U>::value &&
|
||||
(sizeof(T) + sizeof(U)) ==
|
||||
sizeof(std::pair<T, U>))> {};
|
||||
|
||||
/// \brief Helper to get the hashable data representation for a type.
|
||||
/// This variant is enabled when the type itself can be used.
|
||||
template <typename T>
|
||||
typename enable_if<is_hashable_data<T>, T>::type
|
||||
typename std::enable_if<is_hashable_data<T>::value, T>::type
|
||||
get_hashable_data(const T &value) {
|
||||
return value;
|
||||
}
|
||||
@ -377,7 +378,7 @@ get_hashable_data(const T &value) {
|
||||
/// This variant is enabled when we must first call hash_value and use the
|
||||
/// result as our data.
|
||||
template <typename T>
|
||||
typename enable_if_c<!is_hashable_data<T>::value, size_t>::type
|
||||
typename std::enable_if<!is_hashable_data<T>::value, size_t>::type
|
||||
get_hashable_data(const T &value) {
|
||||
using ::llvm::hash_value;
|
||||
return hash_value(value);
|
||||
@ -451,7 +452,7 @@ hash_code hash_combine_range_impl(InputIteratorT first, InputIteratorT last) {
|
||||
/// are stored in contiguous memory, this routine avoids copying each value
|
||||
/// and directly reads from the underlying memory.
|
||||
template <typename ValueT>
|
||||
typename enable_if<is_hashable_data<ValueT>, hash_code>::type
|
||||
typename std::enable_if<is_hashable_data<ValueT>::value, hash_code>::type
|
||||
hash_combine_range_impl(ValueT *first, ValueT *last) {
|
||||
const size_t seed = get_execution_seed();
|
||||
const char *s_begin = reinterpret_cast<const char *>(first);
|
||||
@ -734,7 +735,7 @@ inline hash_code hash_integer_value(uint64_t value) {
|
||||
// Declared and documented above, but defined here so that any of the hashing
|
||||
// infrastructure is available.
|
||||
template <typename T>
|
||||
typename enable_if<is_integral_or_enum<T>, hash_code>::type
|
||||
typename std::enable_if<is_integral_or_enum<T>::value, hash_code>::type
|
||||
hash_value(T value) {
|
||||
return ::llvm::hashing::detail::hash_integer_value(value);
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
#define LLVM_ADT_STRINGREF_H
|
||||
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/type_traits.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
@ -341,7 +340,7 @@ namespace llvm {
|
||||
/// this returns true to signify the error. The string is considered
|
||||
/// erroneous if empty or if it overflows T.
|
||||
template <typename T>
|
||||
typename enable_if_c<std::numeric_limits<T>::is_signed, bool>::type
|
||||
typename std::enable_if<std::numeric_limits<T>::is_signed, bool>::type
|
||||
getAsInteger(unsigned Radix, T &Result) const {
|
||||
long long LLVal;
|
||||
if (getAsSignedInteger(*this, Radix, LLVal) ||
|
||||
@ -352,7 +351,7 @@ namespace llvm {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename enable_if_c<!std::numeric_limits<T>::is_signed, bool>::type
|
||||
typename std::enable_if<!std::numeric_limits<T>::is_signed, bool>::type
|
||||
getAsInteger(unsigned Radix, T &Result) const {
|
||||
unsigned long long ULLVal;
|
||||
if (getAsUnsignedInteger(*this, Radix, ULLVal) ||
|
||||
|
@ -496,13 +496,11 @@ public:
|
||||
//@{
|
||||
template <bool IsConst>
|
||||
class block_iterator_wrapper
|
||||
: public df_iterator<typename conditional<IsConst,
|
||||
const BasicBlock,
|
||||
BasicBlock>::type*> {
|
||||
typedef df_iterator<typename conditional<IsConst,
|
||||
const BasicBlock,
|
||||
BasicBlock>::type*>
|
||||
super;
|
||||
: public df_iterator<typename std::conditional<IsConst, const BasicBlock,
|
||||
BasicBlock>::type *> {
|
||||
typedef df_iterator<typename std::conditional<IsConst, const BasicBlock,
|
||||
BasicBlock>::type *> super;
|
||||
|
||||
public:
|
||||
typedef block_iterator_wrapper<IsConst> Self;
|
||||
typedef typename super::pointer pointer;
|
||||
|
@ -198,7 +198,7 @@ class ValueMapCallbackVH : public CallbackVH {
|
||||
friend class ValueMap<KeyT, ValueT, Config>;
|
||||
friend struct DenseMapInfo<ValueMapCallbackVH>;
|
||||
typedef ValueMap<KeyT, ValueT, Config> ValueMapT;
|
||||
typedef typename llvm::remove_pointer<KeyT>::type KeySansPointerT;
|
||||
typedef typename std::remove_pointer<KeyT>::type KeySansPointerT;
|
||||
|
||||
ValueMapT *Map;
|
||||
|
||||
|
@ -51,8 +51,8 @@ template <class ELFT>
|
||||
class ELFFile {
|
||||
public:
|
||||
LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
|
||||
typedef typename conditional<ELFT::Is64Bits,
|
||||
uint64_t, uint32_t>::type uintX_t;
|
||||
typedef typename std::conditional<ELFT::Is64Bits,
|
||||
uint64_t, uint32_t>::type uintX_t;
|
||||
|
||||
/// \brief Iterate over constant sized entities.
|
||||
template <class EntT>
|
||||
|
@ -41,10 +41,10 @@ inline error_code make_error_code(object_error e) {
|
||||
|
||||
} // end namespace object.
|
||||
|
||||
template <> struct is_error_code_enum<object::object_error> : true_type { };
|
||||
template <> struct is_error_code_enum<object::object_error> : std::true_type {};
|
||||
|
||||
template <> struct is_error_code_enum<object::object_error::Impl> : true_type {
|
||||
};
|
||||
template <>
|
||||
struct is_error_code_enum<object::object_error::Impl> : std::true_type {};
|
||||
|
||||
} // end namespace llvm.
|
||||
|
||||
|
@ -59,11 +59,8 @@ struct isa_impl {
|
||||
|
||||
/// \brief Always allow upcasts, and perform no dynamic check for them.
|
||||
template <typename To, typename From>
|
||||
struct isa_impl<To, From,
|
||||
typename enable_if<
|
||||
llvm::is_base_of<To, From>
|
||||
>::type
|
||||
> {
|
||||
struct isa_impl<
|
||||
To, From, typename std::enable_if<std::is_base_of<To, From>::value>::type> {
|
||||
static inline bool doit(const From &) { return true; }
|
||||
};
|
||||
|
||||
@ -209,7 +206,7 @@ template<class To, class FromTy> struct cast_convert_val<To,FromTy,FromTy> {
|
||||
|
||||
template <class X> struct is_simple_type {
|
||||
static const bool value =
|
||||
is_same<X, typename simplify_type<X>::SimpleType>::value;
|
||||
std::is_same<X, typename simplify_type<X>::SimpleType>::value;
|
||||
};
|
||||
|
||||
// cast<X> - Return the argument parameter cast to the specified type. This
|
||||
@ -220,8 +217,8 @@ template <class X> struct is_simple_type {
|
||||
// cast<Instruction>(myVal)->getParent()
|
||||
//
|
||||
template <class X, class Y>
|
||||
inline typename enable_if_c<!is_simple_type<Y>::value,
|
||||
typename cast_retty<X, const Y>::ret_type>::type
|
||||
inline typename std::enable_if<!is_simple_type<Y>::value,
|
||||
typename cast_retty<X, const Y>::ret_type>::type
|
||||
cast(const Y &Val) {
|
||||
assert(isa<X>(Val) && "cast<Ty>() argument of incompatible type!");
|
||||
return cast_convert_val<
|
||||
@ -263,7 +260,7 @@ cast_or_null(Y *Val) {
|
||||
//
|
||||
|
||||
template <class X, class Y>
|
||||
LLVM_ATTRIBUTE_UNUSED_RESULT inline typename enable_if_c<
|
||||
LLVM_ATTRIBUTE_UNUSED_RESULT inline typename std::enable_if<
|
||||
!is_simple_type<Y>::value, typename cast_retty<X, const Y>::ret_type>::type
|
||||
dyn_cast(const Y &Val) {
|
||||
return isa<X>(Val) ? cast<X>(Val) : 0;
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/type_traits.h"
|
||||
#include <cassert>
|
||||
#include <climits>
|
||||
#include <cstdarg>
|
||||
@ -422,7 +421,7 @@ struct OptionValueBase<DataType, false> : OptionValueCopy<DataType> {
|
||||
|
||||
// Top-level option class.
|
||||
template<class DataType>
|
||||
struct OptionValue : OptionValueBase<DataType, is_class<DataType>::value> {
|
||||
struct OptionValue : OptionValueBase<DataType, std::is_class<DataType>::value> {
|
||||
OptionValue() {}
|
||||
|
||||
OptionValue(const DataType& V) {
|
||||
@ -1156,7 +1155,7 @@ template <class DataType, bool ExternalStorage = false,
|
||||
class ParserClass = parser<DataType> >
|
||||
class opt : public Option,
|
||||
public opt_storage<DataType, ExternalStorage,
|
||||
is_class<DataType>::value> {
|
||||
std::is_class<DataType>::value> {
|
||||
ParserClass Parser;
|
||||
|
||||
bool handleOccurrence(unsigned pos, StringRef ArgName,
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "llvm/Support/AlignOf.h"
|
||||
#include "llvm/Support/Host.h"
|
||||
#include "llvm/Support/SwapByteOrder.h"
|
||||
#include "llvm/Support/type_traits.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace support {
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "llvm/ADT/PointerIntPair.h"
|
||||
#include "llvm/Support/AlignOf.h"
|
||||
#include "llvm/Support/system_error.h"
|
||||
#include "llvm/Support/type_traits.h"
|
||||
#include <cassert>
|
||||
#include <type_traits>
|
||||
|
||||
@ -82,26 +81,22 @@ public:
|
||||
template<class T>
|
||||
class ErrorOr {
|
||||
template <class OtherT> friend class ErrorOr;
|
||||
static const bool isRef = is_reference<T>::value;
|
||||
typedef ReferenceStorage<typename remove_reference<T>::type> wrap;
|
||||
static const bool isRef = std::is_reference<T>::value;
|
||||
typedef ReferenceStorage<typename std::remove_reference<T>::type> wrap;
|
||||
|
||||
public:
|
||||
typedef typename
|
||||
conditional< isRef
|
||||
, wrap
|
||||
, T
|
||||
>::type storage_type;
|
||||
typedef typename std::conditional<isRef, wrap, T>::type storage_type;
|
||||
|
||||
private:
|
||||
typedef typename remove_reference<T>::type &reference;
|
||||
typedef const typename remove_reference<T>::type &const_reference;
|
||||
typedef typename remove_reference<T>::type *pointer;
|
||||
typedef typename std::remove_reference<T>::type &reference;
|
||||
typedef const typename std::remove_reference<T>::type &const_reference;
|
||||
typedef typename std::remove_reference<T>::type *pointer;
|
||||
|
||||
public:
|
||||
template <class E>
|
||||
ErrorOr(E ErrorCode, typename enable_if_c<is_error_code_enum<E>::value ||
|
||||
is_error_condition_enum<E>::value,
|
||||
void *>::type = 0)
|
||||
ErrorOr(E ErrorCode, typename std::enable_if<is_error_code_enum<E>::value ||
|
||||
is_error_condition_enum<E>::value,
|
||||
void *>::type = 0)
|
||||
: HasError(true) {
|
||||
new (getErrorStorage()) error_code(make_error_code(ErrorCode));
|
||||
}
|
||||
@ -270,8 +265,8 @@ private:
|
||||
};
|
||||
|
||||
template<class T, class E>
|
||||
typename enable_if_c<is_error_code_enum<E>::value ||
|
||||
is_error_condition_enum<E>::value, bool>::type
|
||||
typename std::enable_if<is_error_code_enum<E>::value ||
|
||||
is_error_condition_enum<E>::value, bool>::type
|
||||
operator ==(ErrorOr<T> &Err, E Code) {
|
||||
return error_code(Err) == Code;
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/SwapByteOrder.h"
|
||||
#include "llvm/Support/type_traits.h"
|
||||
#include <cstring>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
@ -43,8 +42,8 @@ enum ZeroBehavior {
|
||||
/// \param ZB the behavior on an input of 0. Only ZB_Width and ZB_Undefined are
|
||||
/// valid arguments.
|
||||
template <typename T>
|
||||
typename enable_if_c<std::numeric_limits<T>::is_integer &&
|
||||
!std::numeric_limits<T>::is_signed, std::size_t>::type
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer &&
|
||||
!std::numeric_limits<T>::is_signed, std::size_t>::type
|
||||
countTrailingZeros(T Val, ZeroBehavior ZB = ZB_Width) {
|
||||
(void)ZB;
|
||||
|
||||
@ -70,8 +69,8 @@ countTrailingZeros(T Val, ZeroBehavior ZB = ZB_Width) {
|
||||
|
||||
// Disable signed.
|
||||
template <typename T>
|
||||
typename enable_if_c<std::numeric_limits<T>::is_integer &&
|
||||
std::numeric_limits<T>::is_signed, std::size_t>::type
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer &&
|
||||
std::numeric_limits<T>::is_signed, std::size_t>::type
|
||||
countTrailingZeros(T Val, ZeroBehavior ZB = ZB_Width) LLVM_DELETED_FUNCTION;
|
||||
|
||||
#if __GNUC__ >= 4 || _MSC_VER
|
||||
@ -114,8 +113,8 @@ inline std::size_t countTrailingZeros<uint64_t>(uint64_t Val, ZeroBehavior ZB) {
|
||||
/// \param ZB the behavior on an input of 0. Only ZB_Width and ZB_Undefined are
|
||||
/// valid arguments.
|
||||
template <typename T>
|
||||
typename enable_if_c<std::numeric_limits<T>::is_integer &&
|
||||
!std::numeric_limits<T>::is_signed, std::size_t>::type
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer &&
|
||||
!std::numeric_limits<T>::is_signed, std::size_t>::type
|
||||
countLeadingZeros(T Val, ZeroBehavior ZB = ZB_Width) {
|
||||
(void)ZB;
|
||||
|
||||
@ -136,8 +135,8 @@ countLeadingZeros(T Val, ZeroBehavior ZB = ZB_Width) {
|
||||
|
||||
// Disable signed.
|
||||
template <typename T>
|
||||
typename enable_if_c<std::numeric_limits<T>::is_integer &&
|
||||
std::numeric_limits<T>::is_signed, std::size_t>::type
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer &&
|
||||
std::numeric_limits<T>::is_signed, std::size_t>::type
|
||||
countLeadingZeros(T Val, ZeroBehavior ZB = ZB_Width) LLVM_DELETED_FUNCTION;
|
||||
|
||||
#if __GNUC__ >= 4 || _MSC_VER
|
||||
@ -180,8 +179,8 @@ inline std::size_t countLeadingZeros<uint64_t>(uint64_t Val, ZeroBehavior ZB) {
|
||||
/// \param ZB the behavior on an input of 0. Only ZB_Max and ZB_Undefined are
|
||||
/// valid arguments.
|
||||
template <typename T>
|
||||
typename enable_if_c<std::numeric_limits<T>::is_integer &&
|
||||
!std::numeric_limits<T>::is_signed, T>::type
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer &&
|
||||
!std::numeric_limits<T>::is_signed, T>::type
|
||||
findFirstSet(T Val, ZeroBehavior ZB = ZB_Max) {
|
||||
if (ZB == ZB_Max && Val == 0)
|
||||
return std::numeric_limits<T>::max();
|
||||
@ -191,8 +190,8 @@ findFirstSet(T Val, ZeroBehavior ZB = ZB_Max) {
|
||||
|
||||
// Disable signed.
|
||||
template <typename T>
|
||||
typename enable_if_c<std::numeric_limits<T>::is_integer &&
|
||||
std::numeric_limits<T>::is_signed, T>::type
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer &&
|
||||
std::numeric_limits<T>::is_signed, T>::type
|
||||
findFirstSet(T Val, ZeroBehavior ZB = ZB_Max) LLVM_DELETED_FUNCTION;
|
||||
|
||||
/// \brief Get the index of the last set bit starting from the least
|
||||
@ -203,8 +202,8 @@ findFirstSet(T Val, ZeroBehavior ZB = ZB_Max) LLVM_DELETED_FUNCTION;
|
||||
/// \param ZB the behavior on an input of 0. Only ZB_Max and ZB_Undefined are
|
||||
/// valid arguments.
|
||||
template <typename T>
|
||||
typename enable_if_c<std::numeric_limits<T>::is_integer &&
|
||||
!std::numeric_limits<T>::is_signed, T>::type
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer &&
|
||||
!std::numeric_limits<T>::is_signed, T>::type
|
||||
findLastSet(T Val, ZeroBehavior ZB = ZB_Max) {
|
||||
if (ZB == ZB_Max && Val == 0)
|
||||
return std::numeric_limits<T>::max();
|
||||
@ -217,8 +216,8 @@ findLastSet(T Val, ZeroBehavior ZB = ZB_Max) {
|
||||
|
||||
// Disable signed.
|
||||
template <typename T>
|
||||
typename enable_if_c<std::numeric_limits<T>::is_integer &&
|
||||
std::numeric_limits<T>::is_signed, T>::type
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer &&
|
||||
std::numeric_limits<T>::is_signed, T>::type
|
||||
findLastSet(T Val, ZeroBehavior ZB = ZB_Max) LLVM_DELETED_FUNCTION;
|
||||
|
||||
/// \brief Macro compressed bit reversal table for 256 bits.
|
||||
|
@ -23,8 +23,6 @@
|
||||
#include "llvm/Support/YAMLParser.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Support/system_error.h"
|
||||
#include "llvm/Support/type_traits.h"
|
||||
|
||||
|
||||
namespace llvm {
|
||||
namespace yaml {
|
||||
@ -266,7 +264,7 @@ public:
|
||||
// has_FlowTraits<int> will cause an error with some compilers because
|
||||
// it subclasses int. Using this wrapper only instantiates the
|
||||
// real has_FlowTraits only if the template type is a class.
|
||||
template <typename T, bool Enabled = llvm::is_class<T>::value>
|
||||
template <typename T, bool Enabled = std::is_class<T>::value>
|
||||
class has_FlowTraits
|
||||
{
|
||||
public:
|
||||
@ -296,7 +294,7 @@ public:
|
||||
|
||||
// Test if SequenceTraits<T> is defined on type T
|
||||
template<typename T>
|
||||
struct has_SequenceTraits : public llvm::integral_constant<bool,
|
||||
struct has_SequenceTraits : public std::integral_constant<bool,
|
||||
has_SequenceMethodTraits<T>::value > { };
|
||||
|
||||
|
||||
@ -320,7 +318,7 @@ public:
|
||||
|
||||
|
||||
template<typename T>
|
||||
struct missingTraits : public llvm::integral_constant<bool,
|
||||
struct missingTraits : public std::integral_constant<bool,
|
||||
!has_ScalarEnumerationTraits<T>::value
|
||||
&& !has_ScalarBitSetTraits<T>::value
|
||||
&& !has_ScalarTraits<T>::value
|
||||
@ -329,12 +327,12 @@ struct missingTraits : public llvm::integral_constant<bool,
|
||||
&& !has_DocumentListTraits<T>::value > {};
|
||||
|
||||
template<typename T>
|
||||
struct validatedMappingTraits : public llvm::integral_constant<bool,
|
||||
struct validatedMappingTraits : public std::integral_constant<bool,
|
||||
has_MappingTraits<T>::value
|
||||
&& has_MappingValidateTraits<T>::value> {};
|
||||
|
||||
template<typename T>
|
||||
struct unvalidatedMappingTraits : public llvm::integral_constant<bool,
|
||||
struct unvalidatedMappingTraits : public std::integral_constant<bool,
|
||||
has_MappingTraits<T>::value
|
||||
&& !has_MappingValidateTraits<T>::value> {};
|
||||
// Base class for Input and Output.
|
||||
@ -414,7 +412,7 @@ public:
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename llvm::enable_if_c<has_SequenceTraits<T>::value,void>::type
|
||||
typename std::enable_if<has_SequenceTraits<T>::value,void>::type
|
||||
mapOptional(const char* Key, T& Val) {
|
||||
// omit key/value instead of outputting empty sequence
|
||||
if ( this->canElideEmptySequence() && !(Val.begin() != Val.end()) )
|
||||
@ -423,7 +421,7 @@ public:
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename llvm::enable_if_c<!has_SequenceTraits<T>::value,void>::type
|
||||
typename std::enable_if<!has_SequenceTraits<T>::value,void>::type
|
||||
mapOptional(const char* Key, T& Val) {
|
||||
this->processKey(Key, Val, false);
|
||||
}
|
||||
@ -468,7 +466,7 @@ private:
|
||||
|
||||
|
||||
template<typename T>
|
||||
typename llvm::enable_if_c<has_ScalarEnumerationTraits<T>::value,void>::type
|
||||
typename std::enable_if<has_ScalarEnumerationTraits<T>::value,void>::type
|
||||
yamlize(IO &io, T &Val, bool) {
|
||||
io.beginEnumScalar();
|
||||
ScalarEnumerationTraits<T>::enumeration(io, Val);
|
||||
@ -476,7 +474,7 @@ yamlize(IO &io, T &Val, bool) {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename llvm::enable_if_c<has_ScalarBitSetTraits<T>::value,void>::type
|
||||
typename std::enable_if<has_ScalarBitSetTraits<T>::value,void>::type
|
||||
yamlize(IO &io, T &Val, bool) {
|
||||
bool DoClear;
|
||||
if ( io.beginBitSetScalar(DoClear) ) {
|
||||
@ -489,7 +487,7 @@ yamlize(IO &io, T &Val, bool) {
|
||||
|
||||
|
||||
template<typename T>
|
||||
typename llvm::enable_if_c<has_ScalarTraits<T>::value,void>::type
|
||||
typename std::enable_if<has_ScalarTraits<T>::value,void>::type
|
||||
yamlize(IO &io, T &Val, bool) {
|
||||
if ( io.outputting() ) {
|
||||
std::string Storage;
|
||||
@ -510,7 +508,7 @@ yamlize(IO &io, T &Val, bool) {
|
||||
|
||||
|
||||
template<typename T>
|
||||
typename llvm::enable_if_c<validatedMappingTraits<T>::value, void>::type
|
||||
typename std::enable_if<validatedMappingTraits<T>::value, void>::type
|
||||
yamlize(IO &io, T &Val, bool) {
|
||||
io.beginMapping();
|
||||
if (io.outputting()) {
|
||||
@ -530,7 +528,7 @@ yamlize(IO &io, T &Val, bool) {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename llvm::enable_if_c<unvalidatedMappingTraits<T>::value, void>::type
|
||||
typename std::enable_if<unvalidatedMappingTraits<T>::value, void>::type
|
||||
yamlize(IO &io, T &Val, bool) {
|
||||
io.beginMapping();
|
||||
MappingTraits<T>::mapping(io, Val);
|
||||
@ -538,13 +536,13 @@ yamlize(IO &io, T &Val, bool) {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename llvm::enable_if_c<missingTraits<T>::value, void>::type
|
||||
typename std::enable_if<missingTraits<T>::value, void>::type
|
||||
yamlize(IO &io, T &Val, bool) {
|
||||
char missing_yaml_trait_for_type[sizeof(MissingTrait<T>)];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename llvm::enable_if_c<has_SequenceTraits<T>::value,void>::type
|
||||
typename std::enable_if<has_SequenceTraits<T>::value,void>::type
|
||||
yamlize(IO &io, T &Seq, bool) {
|
||||
if ( has_FlowTraits< SequenceTraits<T> >::value ) {
|
||||
unsigned incnt = io.beginFlowSequence();
|
||||
@ -990,7 +988,7 @@ struct ScalarTraits<Hex64> {
|
||||
// Define non-member operator>> so that Input can stream in a document list.
|
||||
template <typename T>
|
||||
inline
|
||||
typename llvm::enable_if_c<has_DocumentListTraits<T>::value,Input &>::type
|
||||
typename std::enable_if<has_DocumentListTraits<T>::value, Input &>::type
|
||||
operator>>(Input &yin, T &docList) {
|
||||
int i = 0;
|
||||
while ( yin.setCurrentDocument() ) {
|
||||
@ -1006,7 +1004,7 @@ operator>>(Input &yin, T &docList) {
|
||||
// Define non-member operator>> so that Input can stream in a map as a document.
|
||||
template <typename T>
|
||||
inline
|
||||
typename llvm::enable_if_c<has_MappingTraits<T>::value,Input &>::type
|
||||
typename std::enable_if<has_MappingTraits<T>::value, Input &>::type
|
||||
operator>>(Input &yin, T &docMap) {
|
||||
yin.setCurrentDocument();
|
||||
yamlize(yin, docMap, true);
|
||||
@ -1017,7 +1015,7 @@ operator>>(Input &yin, T &docMap) {
|
||||
// a document.
|
||||
template <typename T>
|
||||
inline
|
||||
typename llvm::enable_if_c<has_SequenceTraits<T>::value,Input &>::type
|
||||
typename std::enable_if<has_SequenceTraits<T>::value, Input &>::type
|
||||
operator>>(Input &yin, T &docSeq) {
|
||||
if (yin.setCurrentDocument())
|
||||
yamlize(yin, docSeq, true);
|
||||
@ -1027,7 +1025,7 @@ operator>>(Input &yin, T &docSeq) {
|
||||
// Provide better error message about types missing a trait specialization
|
||||
template <typename T>
|
||||
inline
|
||||
typename llvm::enable_if_c<missingTraits<T>::value,Input &>::type
|
||||
typename std::enable_if<missingTraits<T>::value, Input &>::type
|
||||
operator>>(Input &yin, T &docSeq) {
|
||||
char missing_yaml_trait_for_type[sizeof(MissingTrait<T>)];
|
||||
return yin;
|
||||
@ -1037,7 +1035,7 @@ operator>>(Input &yin, T &docSeq) {
|
||||
// Define non-member operator<< so that Output can stream out document list.
|
||||
template <typename T>
|
||||
inline
|
||||
typename llvm::enable_if_c<has_DocumentListTraits<T>::value,Output &>::type
|
||||
typename std::enable_if<has_DocumentListTraits<T>::value, Output &>::type
|
||||
operator<<(Output &yout, T &docList) {
|
||||
yout.beginDocuments();
|
||||
const size_t count = DocumentListTraits<T>::size(yout, docList);
|
||||
@ -1054,7 +1052,7 @@ operator<<(Output &yout, T &docList) {
|
||||
// Define non-member operator<< so that Output can stream out a map.
|
||||
template <typename T>
|
||||
inline
|
||||
typename llvm::enable_if_c<has_MappingTraits<T>::value,Output &>::type
|
||||
typename std::enable_if<has_MappingTraits<T>::value, Output &>::type
|
||||
operator<<(Output &yout, T &map) {
|
||||
yout.beginDocuments();
|
||||
if ( yout.preflightDocument(0) ) {
|
||||
@ -1068,7 +1066,7 @@ operator<<(Output &yout, T &map) {
|
||||
// Define non-member operator<< so that Output can stream out a sequence.
|
||||
template <typename T>
|
||||
inline
|
||||
typename llvm::enable_if_c<has_SequenceTraits<T>::value,Output &>::type
|
||||
typename std::enable_if<has_SequenceTraits<T>::value, Output &>::type
|
||||
operator<<(Output &yout, T &seq) {
|
||||
yout.beginDocuments();
|
||||
if ( yout.preflightDocument(0) ) {
|
||||
@ -1082,7 +1080,7 @@ operator<<(Output &yout, T &seq) {
|
||||
// Provide better error message about types missing a trait specialization
|
||||
template <typename T>
|
||||
inline
|
||||
typename llvm::enable_if_c<missingTraits<T>::value,Output &>::type
|
||||
typename std::enable_if<missingTraits<T>::value, Output &>::type
|
||||
operator<<(Output &yout, T &seq) {
|
||||
char missing_yaml_trait_for_type[sizeof(MissingTrait<T>)];
|
||||
return yout;
|
||||
|
@ -48,10 +48,10 @@ const error_category& generic_category();
|
||||
const error_category& system_category();
|
||||
|
||||
template <class T> struct is_error_code_enum
|
||||
: public false_type {};
|
||||
: public std::false_type {};
|
||||
|
||||
template <class T> struct is_error_condition_enum
|
||||
: public false_type {};
|
||||
: public std::false_type {};
|
||||
|
||||
class error_code
|
||||
{
|
||||
@ -203,7 +203,7 @@ enum class errc
|
||||
wrong_protocol_type // EPROTOTYPE
|
||||
};
|
||||
|
||||
template <> struct is_error_condition_enum<errc> : true_type { }
|
||||
template <> struct is_error_condition_enum<errc> : std::true_type { }
|
||||
|
||||
error_code make_error_code(errc e);
|
||||
error_condition make_error_condition(errc e);
|
||||
@ -225,7 +225,6 @@ template <> struct hash<std::error_code>;
|
||||
*/
|
||||
|
||||
#include "llvm/Config/llvm-config.h"
|
||||
#include "llvm/Support/type_traits.h"
|
||||
#include <cerrno>
|
||||
#include <string>
|
||||
|
||||
@ -474,11 +473,11 @@ namespace llvm {
|
||||
|
||||
// is_error_code_enum
|
||||
|
||||
template <class Tp> struct is_error_code_enum : public false_type {};
|
||||
template <class Tp> struct is_error_code_enum : public std::false_type {};
|
||||
|
||||
// is_error_condition_enum
|
||||
|
||||
template <class Tp> struct is_error_condition_enum : public false_type {};
|
||||
template <class Tp> struct is_error_condition_enum : public std::false_type {};
|
||||
|
||||
// Some error codes are not present on all platforms, so we provide equivalents
|
||||
// for them:
|
||||
@ -613,9 +612,9 @@ enum _ {
|
||||
operator int() const {return v_;}
|
||||
};
|
||||
|
||||
template <> struct is_error_condition_enum<errc> : true_type { };
|
||||
template <> struct is_error_condition_enum<errc> : std::true_type { };
|
||||
|
||||
template <> struct is_error_condition_enum<errc::_> : true_type { };
|
||||
template <> struct is_error_condition_enum<errc::_> : std::true_type { };
|
||||
|
||||
class error_condition;
|
||||
class error_code;
|
||||
@ -675,7 +674,7 @@ public:
|
||||
: _val_(_val), _cat_(&_cat) {}
|
||||
|
||||
template <class E>
|
||||
error_condition(E _e, typename enable_if_c<
|
||||
error_condition(E _e, typename std::enable_if<
|
||||
is_error_condition_enum<E>::value
|
||||
>::type* = 0)
|
||||
{*this = make_error_condition(_e);}
|
||||
@ -686,13 +685,12 @@ public:
|
||||
}
|
||||
|
||||
template <class E>
|
||||
typename enable_if_c
|
||||
<
|
||||
is_error_condition_enum<E>::value,
|
||||
error_condition&
|
||||
>::type
|
||||
operator=(E _e)
|
||||
{*this = make_error_condition(_e); return *this;}
|
||||
typename std::enable_if<is_error_condition_enum<E>::value,
|
||||
error_condition &>::type
|
||||
operator=(E _e) {
|
||||
*this = make_error_condition(_e);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
_val_ = 0;
|
||||
@ -737,7 +735,7 @@ public:
|
||||
: _val_(_val), _cat_(&_cat) {}
|
||||
|
||||
template <class E>
|
||||
error_code(E _e, typename enable_if_c<
|
||||
error_code(E _e, typename std::enable_if<
|
||||
is_error_code_enum<E>::value
|
||||
>::type* = 0) {
|
||||
*this = make_error_code(_e);
|
||||
@ -749,13 +747,11 @@ public:
|
||||
}
|
||||
|
||||
template <class E>
|
||||
typename enable_if_c
|
||||
<
|
||||
is_error_code_enum<E>::value,
|
||||
error_code&
|
||||
>::type
|
||||
operator=(E _e)
|
||||
{*this = make_error_code(_e); return *this;}
|
||||
typename std::enable_if<is_error_code_enum<E>::value, error_code &>::type
|
||||
operator=(E _e) {
|
||||
*this = make_error_code(_e);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
_val_ = 0;
|
||||
@ -892,9 +888,9 @@ enum _ {
|
||||
};
|
||||
|
||||
|
||||
template <> struct is_error_code_enum<windows_error> : true_type { };
|
||||
template <> struct is_error_code_enum<windows_error> : std::true_type { };
|
||||
|
||||
template <> struct is_error_code_enum<windows_error::_> : true_type { };
|
||||
template <> struct is_error_code_enum<windows_error::_> : std::true_type { };
|
||||
|
||||
inline error_code make_error_code(windows_error e) {
|
||||
return error_code(static_cast<int>(e), system_category());
|
||||
|
@ -41,7 +41,7 @@ struct NonPOD {
|
||||
|
||||
namespace hashing {
|
||||
namespace detail {
|
||||
template <> struct is_hashable_data<LargeTestInteger> : true_type {};
|
||||
template <> struct is_hashable_data<LargeTestInteger> : std::true_type {};
|
||||
} // namespace detail
|
||||
} // namespace hashing
|
||||
|
||||
|
@ -36,7 +36,7 @@ template <typename VectorT>
|
||||
class TinyPtrVectorTest : public testing::Test {
|
||||
protected:
|
||||
typedef typename VectorT::value_type PtrT;
|
||||
typedef typename remove_pointer<PtrT>::type ValueT;
|
||||
typedef typename std::remove_pointer<PtrT>::type ValueT;
|
||||
|
||||
VectorT V;
|
||||
VectorT V2;
|
||||
|
@ -77,12 +77,16 @@ using namespace llvm;
|
||||
|
||||
|
||||
// Test the peculiar behavior of Use in simplify_type.
|
||||
int Check1[is_same<simplify_type<Use>::SimpleType, Value *>::value ? 1 : -1];
|
||||
int Check2[is_same<simplify_type<Use *>::SimpleType, Value *>::value ? 1 : -1];
|
||||
static_assert(std::is_same<simplify_type<Use>::SimpleType, Value *>::value,
|
||||
"Use doesn't simplify correctly!");
|
||||
static_assert(std::is_same<simplify_type<Use *>::SimpleType, Value *>::value,
|
||||
"Use doesn't simplify correctly!");
|
||||
|
||||
// Test that a regular class behaves as expected.
|
||||
int Check3[is_same<simplify_type<foo>::SimpleType, int>::value ? 1 : -1];
|
||||
int Check4[is_same<simplify_type<foo *>::SimpleType, foo *>::value ? 1 : -1];
|
||||
static_assert(std::is_same<simplify_type<foo>::SimpleType, int>::value,
|
||||
"Unexpected simplify_type result!");
|
||||
static_assert(std::is_same<simplify_type<foo *>::SimpleType, foo *>::value,
|
||||
"Unexpected simplify_type result!");
|
||||
|
||||
namespace {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user