[PATCH] D134141: [llvm] Deprecate llvm::empty (NFC)
Kazu Hirata via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 18 22:01:52 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6b49f30fca04: [llvm] Deprecate llvm::empty (NFC) (authored by kazu).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134141/new/
https://reviews.llvm.org/D134141
Files:
llvm/include/llvm/ADT/STLExtras.h
llvm/unittests/ADT/STLExtrasTest.cpp
Index: llvm/unittests/ADT/STLExtrasTest.cpp
===================================================================
--- llvm/unittests/ADT/STLExtrasTest.cpp
+++ llvm/unittests/ADT/STLExtrasTest.cpp
@@ -399,23 +399,6 @@
EXPECT_EQ(5, count);
}
-TEST(STLExtrasTest, EmptyTest) {
- std::vector<void*> V;
- EXPECT_TRUE(llvm::empty(V));
- V.push_back(nullptr);
- EXPECT_FALSE(llvm::empty(V));
-
- std::initializer_list<int> E = {};
- std::initializer_list<int> NotE = {7, 13, 42};
- EXPECT_TRUE(llvm::empty(E));
- EXPECT_FALSE(llvm::empty(NotE));
-
- auto R0 = make_range(V.begin(), V.begin());
- EXPECT_TRUE(llvm::empty(R0));
- auto R1 = make_range(V.begin(), V.end());
- EXPECT_FALSE(llvm::empty(R1));
-}
-
TEST(STLExtrasTest, DropBeginTest) {
SmallVector<int, 5> vec{0, 1, 2, 3, 4};
Index: llvm/include/llvm/ADT/STLExtras.h
===================================================================
--- llvm/include/llvm/ADT/STLExtras.h
+++ llvm/include/llvm/ADT/STLExtras.h
@@ -252,6 +252,7 @@
/// Test whether \p RangeOrContainer is empty. Similar to C++17 std::empty.
template <typename T>
+LLVM_DEPRECATED("Use x.empty() instead", "empty")
constexpr bool empty(const T &RangeOrContainer) {
return adl_begin(RangeOrContainer) == adl_end(RangeOrContainer);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134141.461132.patch
Type: text/x-patch
Size: 1280 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220919/5adcbb47/attachment.bin>
More information about the llvm-commits
mailing list