[llvm] r263760 - Revert "allow lambdas in mapped_iterator"
Mike Aizatsky via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 17 16:32:21 PDT 2016
Author: aizatsky
Date: Thu Mar 17 18:32:20 2016
New Revision: 263760
URL: http://llvm.org/viewvc/llvm-project?rev=263760&view=rev
Log:
Revert "allow lambdas in mapped_iterator"
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.
Removed:
llvm/trunk/unittests/ADT/MappedIteratorTest.cpp
Modified:
llvm/trunk/include/llvm/ADT/STLExtras.h
llvm/trunk/unittests/ADT/CMakeLists.txt
Modified: llvm/trunk/include/llvm/ADT/STLExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/STLExtras.h?rev=263760&r1=263759&r2=263760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/STLExtras.h (original)
+++ llvm/trunk/include/llvm/ADT/STLExtras.h Thu Mar 17 18:32:20 2016
@@ -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;
Modified: llvm/trunk/unittests/ADT/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/CMakeLists.txt?rev=263760&r1=263759&r2=263760&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/CMakeLists.txt (original)
+++ llvm/trunk/unittests/ADT/CMakeLists.txt Thu Mar 17 18:32:20 2016
@@ -22,7 +22,6 @@ set(ADTSources
IntervalMapTest.cpp
IntrusiveRefCntPtrTest.cpp
MakeUniqueTest.cpp
- MappedIteratorTest.cpp
MapVectorTest.cpp
OptionalTest.cpp
PackedVectorTest.cpp
Removed: llvm/trunk/unittests/ADT/MappedIteratorTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/MappedIteratorTest.cpp?rev=263759&view=auto
==============================================================================
--- llvm/trunk/unittests/ADT/MappedIteratorTest.cpp (original)
+++ llvm/trunk/unittests/ADT/MappedIteratorTest.cpp (removed)
@@ -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());
-}
-}
More information about the llvm-commits
mailing list