jloser updated this revision to Diff 451977.
jloser added a comment.
Revert removal of these utilities and type traits from STLForwardCompat.h and
their corresponding unit tests. The removal of these will be done in a separate
patch.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131717/new/
https://reviews.llvm.org/D131717
Files:
clang/include/clang/Basic/DirectoryEntry.h
clang/include/clang/Basic/FileEntry.h
llvm/include/llvm/ADT/Any.h
llvm/include/llvm/ADT/FunctionExtras.h
llvm/include/llvm/ADT/Optional.h
llvm/include/llvm/ADT/STLExtras.h
llvm/include/llvm/Support/HashBuilder.h
llvm/unittests/ADT/OptionalTest.cpp
Index: llvm/unittests/ADT/OptionalTest.cpp
===================================================================
--- llvm/unittests/ADT/OptionalTest.cpp
+++ llvm/unittests/ADT/OptionalTest.cpp
@@ -14,7 +14,7 @@
#include "gtest/gtest.h"
#include <array>
-
+#include <utility>
using namespace llvm;
@@ -201,7 +201,7 @@
TEST(OptionalTest, InPlaceConstructionNonDefaultConstructibleTest) {
NonDefaultConstructible::ResetCounts();
- { Optional<NonDefaultConstructible> A{in_place, 1}; }
+ { Optional<NonDefaultConstructible> A{std::in_place, 1}; }
EXPECT_EQ(0u, NonDefaultConstructible::CopyConstructions);
EXPECT_EQ(0u, NonDefaultConstructible::CopyAssignments);
EXPECT_EQ(1u, NonDefaultConstructible::Destructions);
@@ -247,7 +247,7 @@
TEST(OptionalTest, Emplace) {
MultiArgConstructor::ResetCounts();
Optional<MultiArgConstructor> A;
-
+
A.emplace(1, 2);
EXPECT_TRUE(A.has_value());
EXPECT_TRUE(A.has_value());
@@ -266,12 +266,12 @@
TEST(OptionalTest, InPlaceConstructionMultiArgConstructorTest) {
MultiArgConstructor::ResetCounts();
{
- Optional<MultiArgConstructor> A{in_place, 1, 2};
+ Optional<MultiArgConstructor> A{std::in_place, 1, 2};
EXPECT_TRUE(A.has_value());
EXPECT_TRUE(A.has_value());
EXPECT_EQ(1, A->x);
EXPECT_EQ(2, A->y);
- Optional<MultiArgConstructor> B{in_place, 5, false};
+ Optional<MultiArgConstructor> B{std::in_place, 5, false};
EXPECT_TRUE(B.has_value());
EXPECT_TRUE(B.has_value());
EXPECT_EQ(5, B->x);
@@ -284,7 +284,7 @@
TEST(OptionalTest, InPlaceConstructionAndEmplaceEquivalentTest) {
MultiArgConstructor::ResetCounts();
{
- Optional<MultiArgConstructor> A{in_place, 1, 2};
+ Optional<MultiArgConstructor> A{std::in_place, 1, 2};
Optional<MultiArgConstructor> B;
B.emplace(1, 2);
EXPECT_EQ(0u, MultiArgConstructor::Destructions);
@@ -442,7 +442,7 @@
TEST(OptionalTest, ImmovableInPlaceConstruction) {
Immovable::ResetCounts();
- Optional<Immovable> A{in_place, 4};
+ Optional<Immovable> A{std::in_place, 4};
EXPECT_TRUE((bool)A);
EXPECT_EQ(4, A->val);
EXPECT_EQ(1u, Immovable::Constructions);
Index: llvm/include/llvm/Support/HashBuilder.h
===================================================================
--- llvm/include/llvm/Support/HashBuilder.h
+++ llvm/include/llvm/Support/HashBuilder.h
@@ -76,7 +76,7 @@
template <typename... ArgTypes>
explicit HashBuilderBase(ArgTypes &&...Args)
- : OptionalHasher(in_place, std::forward<ArgTypes>(Args)...),
+ : OptionalHasher(std::in_place, std::forward<ArgTypes>(Args)...),
Hasher(*OptionalHasher) {}
private:
Index: llvm/include/llvm/ADT/STLExtras.h
===================================================================
--- llvm/include/llvm/ADT/STLExtras.h
+++ llvm/include/llvm/ADT/STLExtras.h
@@ -155,12 +155,12 @@
/// traits class for checking whether type T is one of any of the given
/// types in the variadic list.
template <typename T, typename... Ts>
-using is_one_of = disjunction<std::is_same<T, Ts>...>;
+using is_one_of = std::disjunction<std::is_same<T, Ts>...>;
/// traits class for checking whether type T is a base class for all
/// the given types in the variadic list.
template <typename T, typename... Ts>
-using are_base_of = conjunction<std::is_base_of<T, Ts>...>;
+using are_base_of = std::conjunction<std::is_base_of<T, Ts>...>;
namespace detail {
template <typename T, typename... Us> struct TypesAreDistinct;
@@ -1386,12 +1386,12 @@
/// traits class for checking whether type T is one of any of the given
/// types in the variadic list.
template <typename T, typename... Ts>
-using is_one_of = disjunction<std::is_same<T, Ts>...>;
+using is_one_of = std::disjunction<std::is_same<T, Ts>...>;
/// traits class for checking whether type T is a base class for all
/// the given types in the variadic list.
template <typename T, typename... Ts>
-using are_base_of = conjunction<std::is_base_of<T, Ts>...>;
+using are_base_of = std::conjunction<std::is_base_of<T, Ts>...>;
namespace detail {
template <typename... Ts> struct Visitor;
@@ -1550,7 +1550,7 @@
template <typename T>
// We can use qsort if the iterator type is a pointer and the underlying value
// is trivially copyable.
-using sort_trivially_copyable = conjunction<
+using sort_trivially_copyable = std::conjunction<
std::is_pointer<T>,
std::is_trivially_copyable<typename std::iterator_traits<T>::value_type>>;
} // namespace detail
Index: llvm/include/llvm/ADT/Optional.h
===================================================================
--- llvm/include/llvm/ADT/Optional.h
+++ llvm/include/llvm/ADT/Optional.h
@@ -81,7 +81,7 @@
}
template <class... Args>
- constexpr explicit OptionalStorage(in_place_t, Args &&...args)
+ constexpr explicit OptionalStorage(std::in_place_t, Args &&...args)
: val(std::forward<Args>(args)...), hasVal(true) {}
void reset() noexcept {
@@ -196,7 +196,7 @@
OptionalStorage &operator=(OptionalStorage &&other) = default;
template <class... Args>
- constexpr explicit OptionalStorage(in_place_t, Args &&...args)
+ constexpr explicit OptionalStorage(std::in_place_t, Args &&...args)
: val(std::forward<Args>(args)...), hasVal(true) {}
void reset() noexcept {
@@ -275,15 +275,15 @@
constexpr Optional() = default;
constexpr Optional(NoneType) {}
- constexpr Optional(const T &y) : Storage(in_place, y) {}
+ constexpr Optional(const T &y) : Storage(std::in_place, y) {}
constexpr Optional(const Optional &O) = default;
constexpr Optional(T &&y) : Storage(in_place, std::move(y)) {}
constexpr Optional(Optional &&O) = default;
template <typename... ArgTypes>
- constexpr Optional(in_place_t, ArgTypes &&...Args)
- : Storage(in_place, std::forward<ArgTypes>(Args)...) {}
+ constexpr Optional(std::in_place_t, ArgTypes &&...Args)
+ : Storage(std::in_place, std::forward<ArgTypes>(Args)...) {}
Optional &operator=(T &&y) {
Storage = std::move(y);
Index: llvm/include/llvm/ADT/FunctionExtras.h
===================================================================
--- llvm/include/llvm/ADT/FunctionExtras.h
+++ llvm/include/llvm/ADT/FunctionExtras.h
@@ -65,7 +65,7 @@
using EnableUnlessSameType =
std::enable_if_t<!std::is_same<remove_cvref_t<CallableT>, ThisT>::value>;
template <typename CallableT, typename Ret, typename... Params>
-using EnableIfCallable = std::enable_if_t<llvm::disjunction<
+using EnableIfCallable = std::enable_if_t<std::disjunction<
std::is_void<Ret>,
std::is_same<decltype(std::declval<CallableT>()(std::declval<Params>()...)),
Ret>,
Index: llvm/include/llvm/ADT/Any.h
===================================================================
--- llvm/include/llvm/ADT/Any.h
+++ llvm/include/llvm/ADT/Any.h
@@ -68,8 +68,8 @@
// instead.
template <typename T,
std::enable_if_t<
- llvm::conjunction<
- llvm::negation<std::is_same<std::decay_t<T>, Any>>,
+ std::conjunction<
+ std::negation<std::is_same<std::decay_t<T>, Any>>,
// We also disable this overload when an `Any` object can be
// converted to the parameter type because in that case,
// this constructor may combine with that conversion during
@@ -80,7 +80,7 @@
// DR in `std::any` as well, but we're going ahead and
// adopting it to work-around usage of `Any` with types that
// need to be implicitly convertible from an `Any`.
- llvm::negation<std::is_convertible<Any, std::decay_t<T>>>,
+ std::negation<std::is_convertible<Any, std::decay_t<T>>>,
std::is_copy_constructible<std::decay_t<T>>>::value,
int> = 0>
Any(T &&Value) {
Index: clang/include/clang/Basic/FileEntry.h
===================================================================
--- clang/include/clang/Basic/FileEntry.h
+++ clang/include/clang/Basic/FileEntry.h
@@ -24,6 +24,8 @@
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/FileSystem/UniqueID.h"
+#include <utility>
+
namespace llvm {
class MemoryBuffer;
@@ -222,8 +224,8 @@
OptionalStorage() = default;
template <class... ArgTypes>
- explicit OptionalStorage(in_place_t, ArgTypes &&...Args)
- : StorageImpl(in_place_t{}, std::forward<ArgTypes>(Args)...) {}
+ explicit OptionalStorage(std::in_place_t, ArgTypes &&...Args)
+ : StorageImpl(std::in_place_t{}, std::forward<ArgTypes>(Args)...) {}
OptionalStorage &operator=(clang::FileEntryRef Ref) {
StorageImpl::operator=(Ref);
Index: clang/include/clang/Basic/DirectoryEntry.h
===================================================================
--- clang/include/clang/Basic/DirectoryEntry.h
+++ clang/include/clang/Basic/DirectoryEntry.h
@@ -22,6 +22,8 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/ErrorOr.h"
+#include <utility>
+
namespace clang {
namespace FileMgr {
@@ -125,7 +127,7 @@
MapEntryOptionalStorage() : MaybeRef(optional_none_tag()) {}
template <class... ArgTypes>
- explicit MapEntryOptionalStorage(llvm::in_place_t, ArgTypes &&...Args)
+ explicit MapEntryOptionalStorage(std::in_place_t, ArgTypes &&...Args)
: MaybeRef(std::forward<ArgTypes>(Args)...) {}
void reset() { MaybeRef = optional_none_tag(); }
@@ -189,8 +191,8 @@
OptionalStorage() = default;
template <class... ArgTypes>
- explicit OptionalStorage(in_place_t, ArgTypes &&...Args)
- : StorageImpl(in_place_t{}, std::forward<ArgTypes>(Args)...) {}
+ explicit OptionalStorage(std::in_place_t, ArgTypes &&...Args)
+ : StorageImpl(std::in_place_t{}, std::forward<ArgTypes>(Args)...) {}
OptionalStorage &operator=(clang::DirectoryEntryRef Ref) {
StorageImpl::operator=(Ref);
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits