Revert "allow lambdas in mapped_iterator"
authorMike Aizatsky <aizatsky@chromium.org>
Thu, 17 Mar 2016 23:32:20 +0000 (23:32 +0000)
committerMike Aizatsky <aizatsky@chromium.org>
Thu, 17 Mar 2016 23:32:20 +0000 (23:32 +0000)
MSVC as usual:

C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\include\llvm/ADT/STLExtras.h(120):
error C2100: illegal indirection
C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\include\llvm/IR/Instructions.h(3966):
note: see reference to class template instantiation
'llvm::mapped_iterator<llvm::User::op_iterator,llvm::CatchSwitchInst::DerefFnTy>'
being compiled

This reverts commit e091dd63f1f34e043748e28ad160d3bc17731168.

llvm-svn: 263760

llvm/include/llvm/ADT/STLExtras.h
llvm/unittests/ADT/CMakeLists.txt
llvm/unittests/ADT/MappedIteratorTest.cpp [deleted file]

index e40a29f..28f7594 100644 (file)
@@ -117,7 +117,7 @@ public:
           iterator_category;
   typedef typename std::iterator_traits<RootIt>::difference_type
           difference_type;
-  typedef decltype(Fn(*current)) value_type;
+  typedef typename UnaryFunc::result_type value_type;
 
   typedef void pointer;
   //typedef typename UnaryFunc::result_type *pointer;
index 1388f5d..bce1bf9 100644 (file)
@@ -22,7 +22,6 @@ set(ADTSources
   IntervalMapTest.cpp
   IntrusiveRefCntPtrTest.cpp
   MakeUniqueTest.cpp
-  MappedIteratorTest.cpp
   MapVectorTest.cpp
   OptionalTest.cpp
   PackedVectorTest.cpp
diff --git a/llvm/unittests/ADT/MappedIteratorTest.cpp b/llvm/unittests/ADT/MappedIteratorTest.cpp
deleted file mode 100644 (file)
index 8c6a103..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-//===- llvm/unittest/ADT/APInt.cpp - APInt unit tests ---------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <vector>
-
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/iterator_range.h"
-#include "gtest/gtest.h"
-
-using namespace llvm;
-
-namespace {
-
-template <class T, class Fn>
-auto map_range(const T &range, Fn fn)
-    -> decltype(make_range(map_iterator(range.begin(), fn),
-                           map_iterator(range.end(), fn))) {
-  return make_range(map_iterator(range.begin(), fn),
-                    map_iterator(range.end(), fn));
-}
-
-static char add1(char C) { return C + 1; }
-
-TEST(MappedIterator, FnTest) {
-  std::string S("abc");
-  std::string T;
-
-  for (char C : map_range(S, add1)) {
-    T.push_back(C);
-  }
-
-  EXPECT_STREQ("bcd", T.c_str());
-}
-
-TEST(MappedIterator, LambdaTest) {
-  std::string S("abc");
-  std::string T;
-
-  for (char C : map_range(S, [](char C) { return C + 1; })) {
-    T.push_back(C);
-  }
-
-  EXPECT_STREQ("bcd", T.c_str());
-}
-}