1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Add LLVM_HAS_INITIALIZER_LISTS for upcoming C++11 support. Use it in ArrayRef

llvm-svn: 194362
This commit is contained in:
Pete Cooper 2013-11-11 03:58:00 +00:00
parent cafa93e8e2
commit ef6cf2aa2f
2 changed files with 16 additions and 0 deletions

View File

@ -83,6 +83,13 @@ namespace llvm {
/*implicit*/ LLVM_CONSTEXPR ArrayRef(const T (&Arr)[N]) /*implicit*/ LLVM_CONSTEXPR ArrayRef(const T (&Arr)[N])
: Data(Arr), Length(N) {} : Data(Arr), Length(N) {}
#if LLVM_HAS_INITIALIZER_LISTS
/// Construct an ArrayRef from a std::initializer_list.
/*implicit*/ ArrayRef(const std::initializer_list<T> &Vec)
: Data(Vec.begin() == Vec.end() ? (T*)0 : Vec.begin()),
Length(Vec.size()) {}
#endif
/// @} /// @}
/// @name Simple Operations /// @name Simple Operations
/// @{ /// @{

View File

@ -403,4 +403,13 @@
# define LLVM_ENUM_INT_TYPE(intty) # define LLVM_ENUM_INT_TYPE(intty)
#endif #endif
/// \brief Does the compiler support generalized initializers (using braced
/// lists and std::initializer_list).
#if (__has_feature(cxx_generalized_initializers) \
|| defined(__GXX_EXPERIMENTAL_CXX0X__))
#define LLVM_HAS_INITIALIZER_LISTS 1
#else
#define LLVM_HAS_INITIALIZER_LISTS 0
#endif
#endif #endif