diff --git a/libc/src/__support/CPP/CMakeLists.txt b/libc/src/__support/CPP/CMakeLists.txt index d9126b16ce7ea..7172dae2615dd 100644 --- a/libc/src/__support/CPP/CMakeLists.txt +++ b/libc/src/__support/CPP/CMakeLists.txt @@ -41,7 +41,7 @@ add_header_library( add_header_library( functional HDRS - Functional.h + functional.h ) add_header_library( diff --git a/libc/src/__support/CPP/Functional.h b/libc/src/__support/CPP/functional.h similarity index 65% rename from libc/src/__support/CPP/Functional.h rename to libc/src/__support/CPP/functional.h index 51f63314af14b..5919306ad707e 100644 --- a/libc/src/__support/CPP/Functional.h +++ b/libc/src/__support/CPP/functional.h @@ -12,16 +12,16 @@ namespace __llvm_libc { namespace cpp { -template class Function; +template class function; -template class Function { - Ret (*func)(Params...) = nullptr; +template class function { + R (*func)(Args...) = nullptr; public: - constexpr Function() = default; - template constexpr Function(Func &&f) : func(f) {} + constexpr function() = default; + template constexpr function(F &&f) : func(f) {} - constexpr Ret operator()(Params... params) { return func(params...); } + constexpr R operator()(Args... params) { return func(params...); } }; } // namespace cpp diff --git a/libc/test/src/__support/OSUtil/linux/x86_64/syscall_test.cpp b/libc/test/src/__support/OSUtil/linux/x86_64/syscall_test.cpp index 2f9816e968291..4869e0028df0a 100644 --- a/libc/test/src/__support/OSUtil/linux/x86_64/syscall_test.cpp +++ b/libc/test/src/__support/OSUtil/linux/x86_64/syscall_test.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/__support/CPP/Functional.h" +#include "src/__support/CPP/functional.h" #include "src/__support/OSUtil/syscall.h" #include "utils/UnitTest/Test.h" @@ -14,30 +14,30 @@ TEST(LlvmLibcX86_64_SyscallTest, APITest) { // We only do a signature test here. Actual functionality tests are // done by the unit tests of the syscall wrappers like mmap. - using __llvm_libc::cpp::Function; + using __llvm_libc::cpp::function; - Function f([](long n) { return __llvm_libc::syscall(n); }); - Function f1( + function f([](long n) { return __llvm_libc::syscall(n); }); + function f1( [](long n, long a1) { return __llvm_libc::syscall(n, a1); }); - Function f2( + function f2( [](long n, long a1, long a2) { return __llvm_libc::syscall(n, a1, a2); }); - Function f3( + function f3( [](long n, long a1, long a2, long a3) { return __llvm_libc::syscall(n, a1, a2, a3); }); - Function f4( + function f4( [](long n, long a1, long a2, long a3, long a4) { return __llvm_libc::syscall(n, a1, a2, a3, a4); }); - Function f5( + function f5( [](long n, long a1, long a2, long a3, long a4, long a5) { return __llvm_libc::syscall(n, a1, a2, a3, a4, a5); }); - Function f6( + function f6( [](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); }); - Function not_long_type( + function not_long_type( [](long n, void *a1) { return __llvm_libc::syscall(n, a1); }); } diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel index e4fec95e023ec..6ee055f9ca01a 100644 --- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel @@ -65,7 +65,7 @@ cc_library( cc_library( name = "__support_cpp_functional", - hdrs = ["src/__support/CPP/Functional.h"], + hdrs = ["src/__support/CPP/functional.h"], deps = [":libc_root"], )