I believe we no longer require LLVM_HAS_INITIALIZER_LISTS; it's supported in MSVC...
authorAaron Ballman <aaron@aaronballman.com>
Tue, 17 Feb 2015 15:37:53 +0000 (15:37 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Tue, 17 Feb 2015 15:37:53 +0000 (15:37 +0000)
If any of the bots complain (perhaps due to an antiquated version of an STL implementation), I will revert.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229502 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/ArrayRef.h
include/llvm/Support/Compiler.h
unittests/ADT/ArrayRefTest.cpp

index 8c14a423c8f50614ff30856b19d11c96774b359e..5b7ed9cb77da1953b1ecdadc4aaae3b520c7319d 100644 (file)
@@ -97,12 +97,10 @@ namespace llvm {
     /*implicit*/ LLVM_CONSTEXPR ArrayRef(const T (&Arr)[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
 
     /// Construct an ArrayRef<const T*> from ArrayRef<T*>. This uses SFINAE to
     /// ensure that only ArrayRefs of pointers can be converted.
index 855a3db417fb226cf5cfcc2f59ebe059c8ab94d5..f7de840437df29f77e4f919a2be6576ab8f2060c 100644 (file)
 # define LLVM_IS_UNALIGNED_ACCESS_FAST 0
 #endif
 
-/// \brief Does the compiler support generalized initializers (using braced
-/// lists and std::initializer_list).  While clang may claim it supports general
-/// initializers, if we're using MSVC's headers, we might not have a usable
-/// std::initializer list type from the STL.  Disable this for now.
-#if __has_feature(cxx_generalized_initializers) && !defined(_MSC_VER)
-#define LLVM_HAS_INITIALIZER_LISTS 1
-#else
-#define LLVM_HAS_INITIALIZER_LISTS 0
-#endif
-
 /// \brief Mark debug helper function definitions like dump() that should not be
 /// stripped from debug builds.
 // FIXME: Move this to a private config.h as it's not usable in public headers.
index f9c98a563fa3cbb39035cac2f034e82b31f11b3f..c6854aed4b64af31cc880691d84b48c7c75da863 100644 (file)
@@ -90,4 +90,10 @@ TEST(ArrayRefTest, ConstConvert) {
   a = ArrayRef<int *>(A);
 }
 
+TEST(ArrayRefTest, InitializerList) {
+  ArrayRef<int> A{ 0, 1, 2, 3, 4 };
+  for (int i = 0; i < 5; ++i)
+    EXPECT_EQ(i, A[i]);
+}
+
 } // end anonymous namespace