forked from OSchip/llvm-project
[libc][NFC] Rename cpp::function to cpp::Function.
Summary: Just to be consistent with other names in cpp. Reviewers: abrachet Subscribers: tschuett, libc-commits Tags: #libc-project Differential Revision: https://reviews.llvm.org/D79189
This commit is contained in:
parent
d93ae65253
commit
675eea46f0
|
@ -15,30 +15,30 @@ TEST(X86_64_SyscallTest, APITest) {
|
||||||
// We only do a signature test here. Actual functionality tests are
|
// We only do a signature test here. Actual functionality tests are
|
||||||
// done by the unit tests of the syscall wrappers like mmap.
|
// done by the unit tests of the syscall wrappers like mmap.
|
||||||
|
|
||||||
using __llvm_libc::cpp::function;
|
using __llvm_libc::cpp::Function;
|
||||||
|
|
||||||
function<long(long)> f([](long n) { return __llvm_libc::syscall(n); });
|
Function<long(long)> f([](long n) { return __llvm_libc::syscall(n); });
|
||||||
function<long(long, long)> f1(
|
Function<long(long, long)> f1(
|
||||||
[](long n, long a1) { return __llvm_libc::syscall(n, a1); });
|
[](long n, long a1) { return __llvm_libc::syscall(n, a1); });
|
||||||
function<long(long, long, long)> f2(
|
Function<long(long, long, long)> f2(
|
||||||
[](long n, long a1, long a2) { return __llvm_libc::syscall(n, a1, a2); });
|
[](long n, long a1, long a2) { return __llvm_libc::syscall(n, a1, a2); });
|
||||||
function<long(long, long, long, long)> f3(
|
Function<long(long, long, long, long)> f3(
|
||||||
[](long n, long a1, long a2, long a3) {
|
[](long n, long a1, long a2, long a3) {
|
||||||
return __llvm_libc::syscall(n, a1, a2, a3);
|
return __llvm_libc::syscall(n, a1, a2, a3);
|
||||||
});
|
});
|
||||||
function<long(long, long, long, long, long)> f4(
|
Function<long(long, long, long, long, long)> f4(
|
||||||
[](long n, long a1, long a2, long a3, long a4) {
|
[](long n, long a1, long a2, long a3, long a4) {
|
||||||
return __llvm_libc::syscall(n, a1, a2, a3, a4);
|
return __llvm_libc::syscall(n, a1, a2, a3, a4);
|
||||||
});
|
});
|
||||||
function<long(long, long, long, long, long, long)> f5(
|
Function<long(long, long, long, long, long, long)> f5(
|
||||||
[](long n, long a1, long a2, long a3, long a4, long a5) {
|
[](long n, long a1, long a2, long a3, long a4, long a5) {
|
||||||
return __llvm_libc::syscall(n, a1, a2, a3, a4, a5);
|
return __llvm_libc::syscall(n, a1, a2, a3, a4, a5);
|
||||||
});
|
});
|
||||||
function<long(long, long, long, long, long, long, long)> f6(
|
Function<long(long, long, long, long, long, long, long)> f6(
|
||||||
[](long n, long a1, long a2, long a3, long a4, long a5, long a6) {
|
[](long n, long a1, long a2, long a3, long a4, long a5, long a6) {
|
||||||
return __llvm_libc::syscall(n, a1, a2, a3, a4, a5, a6);
|
return __llvm_libc::syscall(n, a1, a2, a3, a4, a5, a6);
|
||||||
});
|
});
|
||||||
|
|
||||||
function<long(long, void *)> notLongType(
|
Function<long(long, void *)> notLongType(
|
||||||
[](long n, void *a1) { return __llvm_libc::syscall(n, a1); });
|
[](long n, void *a1) { return __llvm_libc::syscall(n, a1); });
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,14 +12,14 @@
|
||||||
namespace __llvm_libc {
|
namespace __llvm_libc {
|
||||||
namespace cpp {
|
namespace cpp {
|
||||||
|
|
||||||
template <typename Func> class function;
|
template <typename Func> class Function;
|
||||||
|
|
||||||
template <typename Ret, typename... Params> class function<Ret(Params...)> {
|
template <typename Ret, typename... Params> class Function<Ret(Params...)> {
|
||||||
Ret (*func)(Params...) = nullptr;
|
Ret (*func)(Params...) = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
constexpr function() = default;
|
constexpr Function() = default;
|
||||||
template <typename Func> constexpr function(Func &&f) : func(f) {}
|
template <typename Func> constexpr Function(Func &&f) : func(f) {}
|
||||||
|
|
||||||
constexpr Ret operator()(Params... params) { return func(params...); }
|
constexpr Ret operator()(Params... params) { return func(params...); }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue