[llvm] r225064 - Revert r225053: Add an ArrayRef upcasting constructor from ArrayRef<U*> -> ArrayRef<T*> where T is a base of U.

Michael Gottesman mgottesman at apple.com
Thu Jan 1 05:37:55 PST 2015


Thanks!

Michael

> On Jan 1, 2015, at 8:01 AM, Chandler Carruth <chandlerc at gmail.com> wrote:
> 
> Author: chandlerc
> Date: Thu Jan  1 07:01:25 2015
> New Revision: 225064
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=225064&view=rev
> Log:
> Revert r225053: Add an ArrayRef upcasting constructor from ArrayRef<U*> -> ArrayRef<T*> where T is a base of U.
> 
> This appears to have broken at least the windows build bots due to
> compile errors in the predicate that didn't simply supress the overload.
> I'm not sure what the fix is, and the bots have been broken for a long
> time now so I'm just reverting until Michael can figure out a fix.
> 
> Modified:
>    llvm/trunk/include/llvm/ADT/ArrayRef.h
>    llvm/trunk/unittests/ADT/ArrayRefTest.cpp
> 
> Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ArrayRef.h?rev=225064&r1=225063&r2=225064&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/ArrayRef.h (original)
> +++ llvm/trunk/include/llvm/ADT/ArrayRef.h Thu Jan  1 07:01:25 2015
> @@ -112,16 +112,6 @@ namespace llvm {
>                  std::is_convertible<U *const *, T const *>::value>::type* = 0)
>       : Data(A.data()), Length(A.size()) {}
> 
> -    /// Construct an ArrayRef<T*> from an ArrayRef<U*> where T is a super class
> -    /// of U. This uses SFINAE to ensure that only ArrayRefs with this property
> -    /// can be converted. This is an upcasting constructor.
> -    template <typename U>
> -    ArrayRef(const ArrayRef<U> &A,
> -             typename std::enable_if<std::is_base_of<
> -                 typename std::remove_pointer<T>::type,
> -                 typename std::remove_pointer<U>::type>::value>::type * = 0)
> -        : Data(reinterpret_cast<T const *>(A.data())), Length(A.size()) {}
> -
>     /// @}
>     /// @name Simple Operations
>     /// @{
> 
> Modified: llvm/trunk/unittests/ADT/ArrayRefTest.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/ArrayRefTest.cpp?rev=225064&r1=225063&r2=225064&view=diff
> ==============================================================================
> --- llvm/trunk/unittests/ADT/ArrayRefTest.cpp (original)
> +++ llvm/trunk/unittests/ADT/ArrayRefTest.cpp Thu Jan  1 07:01:25 2015
> @@ -90,39 +90,4 @@ TEST(ArrayRefTest, ConstConvert) {
>   a = ArrayRef<int *>(A);
> }
> 
> -struct A {
> -  int data;
> -
> -  A() : data(0) {}
> -};
> -
> -struct B : A {
> -  int data2;
> -
> -  B() : A(), data2(0) {}
> -};
> -
> -TEST(ArrayRefTest, UpcastConvert) {
> -  B Data[5];
> -
> -  for (unsigned i = 0, e = 5; i != e; ++i) {
> -    Data[i].data = i + 5;
> -    Data[i].data2 = i + 30;
> -  }
> -
> -  B *DataPtrs[5];
> -  for (unsigned i = 0, e = 5; i != e; ++i) {
> -    DataPtrs[i] = &Data[i];
> -  }
> -
> -  ArrayRef<B *> BArray(DataPtrs, 5);
> -  ArrayRef<A *> AArray(BArray);
> -
> -  EXPECT_TRUE(AArray.size() == 5);
> -  for (unsigned i = 0, e = 5; i != e; ++i) {
> -    A *a = AArray[i];
> -    EXPECT_TRUE(a->data == int(i + 5));
> -  }
> -}
> -
> } // end anonymous namespace
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list