Skip to content

Commit bcdbd0b

Browse files
committed
Revert "[libc][NFC] split type_traits / utility in separate files (llvm#65314)"
This reverts commit b793c7e. It broke the libc-x86_64-debian-gcc-fullbuild-dbg build bot. https://lab.llvm.org/buildbot/#/builders/250/builds/9776
1 parent af9b25f commit bcdbd0b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+395
-1499
lines changed

libc/src/__support/CPP/functional.h

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@
99
#ifndef LLVM_LIBC_SRC_SUPPORT_CPP_FUNCTIONAL_H
1010
#define LLVM_LIBC_SRC_SUPPORT_CPP_FUNCTIONAL_H
1111

12-
#include "src/__support/CPP/type_traits/enable_if.h"
13-
#include "src/__support/CPP/type_traits/is_convertible.h"
14-
#include "src/__support/CPP/type_traits/is_same.h"
15-
#include "src/__support/CPP/type_traits/is_void.h"
16-
#include "src/__support/CPP/type_traits/remove_cvref.h"
17-
#include "src/__support/CPP/type_traits/remove_reference.h"
18-
#include "src/__support/CPP/utility/forward.h"
12+
#include "src/__support/CPP/type_traits.h"
13+
#include "src/__support/CPP/utility.h"
1914
#include "src/__support/macros/attributes.h"
2015

2116
#include <stdint.h>
@@ -35,7 +30,7 @@ template <typename Ret, typename... Params> class function<Ret(Params...)> {
3530
template <typename Callable>
3631
LIBC_INLINE static Ret callback_fn(intptr_t callable, Params... params) {
3732
return (*reinterpret_cast<Callable *>(callable))(
38-
cpp::forward<Params>(params)...);
33+
forward<Params>(params)...);
3934
}
4035

4136
public:
@@ -47,18 +42,18 @@ template <typename Ret, typename... Params> class function<Ret(Params...)> {
4742
LIBC_INLINE function(
4843
Callable &&callable,
4944
// This is not the copy-constructor.
50-
enable_if_t<!cpp::is_same_v<remove_cvref_t<Callable>, function>> * =
45+
enable_if_t<!is_same<remove_cvref_t<Callable>, function>::value> * =
5146
nullptr,
5247
// Functor must be callable and return a suitable type.
53-
enable_if_t<cpp::is_void_v<Ret> ||
54-
cpp::is_convertible_v<
48+
enable_if_t<is_void_v<Ret> ||
49+
is_convertible_v<
5550
decltype(declval<Callable>()(declval<Params>()...)), Ret>>
5651
* = nullptr)
57-
: callback(callback_fn<cpp::remove_reference_t<Callable>>),
52+
: callback(callback_fn<remove_reference_t<Callable>>),
5853
callable(reinterpret_cast<intptr_t>(&callable)) {}
5954

6055
LIBC_INLINE Ret operator()(Params... params) const {
61-
return callback(callable, cpp::forward<Params>(params)...);
56+
return callback(callable, forward<Params>(params)...);
6257
}
6358

6459
LIBC_INLINE explicit operator bool() const { return callback; }

0 commit comments

Comments
 (0)