[libc] Mass replace enclosing namespace (#67032)
This is step 4 of https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079
This commit is contained in:
parent
7675f541f7
commit
b6bc9d72f6
@ -162,7 +162,7 @@ function(add_libc_multi_impl_benchmark name)
|
||||
get_target_property(entrypoint_object_file ${fq_config_name} "OBJECT_FILE_RAW")
|
||||
target_link_libraries(${benchmark_name} PUBLIC json ${entrypoint_object_file})
|
||||
string(TOUPPER ${name} name_upper)
|
||||
target_compile_definitions(${benchmark_name} PRIVATE "-DLIBC_BENCHMARK_FUNCTION_${name_upper}=__llvm_libc::${name}" "-DLIBC_BENCHMARK_FUNCTION_NAME=\"${fq_config_name}\"")
|
||||
target_compile_definitions(${benchmark_name} PRIVATE "-DLIBC_BENCHMARK_FUNCTION_${name_upper}=LIBC_NAMESPACE::${name}" "-DLIBC_BENCHMARK_FUNCTION_NAME=\"${fq_config_name}\"")
|
||||
llvm_update_compile_flags(${benchmark_name})
|
||||
else()
|
||||
message(STATUS "Skipping benchmark for '${fq_config_name}' insufficient host cpu features '${required_cpu_features}'")
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include <cstddef>
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
|
||||
extern void *memcpy(void *__restrict, const void *__restrict, size_t);
|
||||
extern void *memmove(void *, const void *, size_t);
|
||||
@ -11,7 +11,7 @@ extern void bzero(void *, size_t);
|
||||
extern int memcmp(const void *, const void *, size_t);
|
||||
extern int bcmp(const void *, const void *, size_t);
|
||||
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
// List of implementations to test.
|
||||
|
||||
@ -23,31 +23,31 @@ using llvm::libc_benchmarks::MemsetConfiguration;
|
||||
|
||||
llvm::ArrayRef<MemcpyConfiguration> getMemcpyConfigurations() {
|
||||
static constexpr MemcpyConfiguration kMemcpyConfigurations[] = {
|
||||
{__llvm_libc::memcpy, "__llvm_libc::memcpy"}};
|
||||
{LIBC_NAMESPACE::memcpy, "LIBC_NAMESPACE::memcpy"}};
|
||||
return llvm::ArrayRef(kMemcpyConfigurations);
|
||||
}
|
||||
llvm::ArrayRef<MemmoveConfiguration> getMemmoveConfigurations() {
|
||||
static constexpr MemmoveConfiguration kMemmoveConfigurations[] = {
|
||||
{__llvm_libc::memmove, "__llvm_libc::memmove"}};
|
||||
{LIBC_NAMESPACE::memmove, "LIBC_NAMESPACE::memmove"}};
|
||||
return llvm::ArrayRef(kMemmoveConfigurations);
|
||||
}
|
||||
llvm::ArrayRef<MemcmpOrBcmpConfiguration> getMemcmpConfigurations() {
|
||||
static constexpr MemcmpOrBcmpConfiguration kMemcmpConfiguration[] = {
|
||||
{__llvm_libc::memcmp, "__llvm_libc::memcmp"}};
|
||||
{LIBC_NAMESPACE::memcmp, "LIBC_NAMESPACE::memcmp"}};
|
||||
return llvm::ArrayRef(kMemcmpConfiguration);
|
||||
}
|
||||
llvm::ArrayRef<MemcmpOrBcmpConfiguration> getBcmpConfigurations() {
|
||||
static constexpr MemcmpOrBcmpConfiguration kBcmpConfigurations[] = {
|
||||
{__llvm_libc::bcmp, "__llvm_libc::bcmp"}};
|
||||
{LIBC_NAMESPACE::bcmp, "LIBC_NAMESPACE::bcmp"}};
|
||||
return llvm::ArrayRef(kBcmpConfigurations);
|
||||
}
|
||||
llvm::ArrayRef<MemsetConfiguration> getMemsetConfigurations() {
|
||||
static constexpr MemsetConfiguration kMemsetConfigurations[] = {
|
||||
{__llvm_libc::memset, "__llvm_libc::memset"}};
|
||||
{LIBC_NAMESPACE::memset, "LIBC_NAMESPACE::memset"}};
|
||||
return llvm::ArrayRef(kMemsetConfigurations);
|
||||
}
|
||||
llvm::ArrayRef<BzeroConfiguration> getBzeroConfigurations() {
|
||||
static constexpr BzeroConfiguration kBzeroConfigurations[] = {
|
||||
{__llvm_libc::bzero, "__llvm_libc::bzero"}};
|
||||
{LIBC_NAMESPACE::bzero, "LIBC_NAMESPACE::bzero"}};
|
||||
return llvm::ArrayRef(kBzeroConfigurations);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace libc_benchmarks {
|
||||
struct StudyConfiguration {
|
||||
// One of 'memcpy', 'memset', 'memcmp'.
|
||||
// The underlying implementation is always the llvm libc one.
|
||||
// e.g. 'memcpy' will test '__llvm_libc::memcpy'
|
||||
// e.g. 'memcpy' will test 'LIBC_NAMESPACE::memcpy'
|
||||
std::string Function;
|
||||
|
||||
// The number of trials to run for this benchmark.
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <cstring>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
|
||||
extern void *memcpy(void *__restrict, const void *__restrict, size_t);
|
||||
extern void *memmove(void *, const void *, size_t);
|
||||
@ -30,7 +30,7 @@ extern void bzero(void *, size_t);
|
||||
extern int memcmp(const void *, const void *, size_t);
|
||||
extern int bcmp(const void *, const void *, size_t);
|
||||
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
namespace llvm {
|
||||
namespace libc_benchmarks {
|
||||
|
@ -62,7 +62,7 @@ namespace functions {
|
||||
// static void memcpy_0xB20D4702493C397E(char *__restrict dst,
|
||||
// const char *__restrict src,
|
||||
// size_t size) {
|
||||
// using namespace __llvm_libc::x86;
|
||||
// using namespace LIBC_NAMESPACE::x86;
|
||||
// if(size == 0) return;
|
||||
// if(size == 1) return copy<_1>(dst, src);
|
||||
// if(size < 4) return copy<HeadTail<_2>>(dst, src, size);
|
||||
@ -249,7 +249,7 @@ static raw_ostream &operator<<(raw_ostream &Stream,
|
||||
const auto &Ctx = FI.Ctx;
|
||||
Stream << "static " << Ctx.FunctionReturnType << ' ' << FI.Name
|
||||
<< Ctx.FunctionArgs << " {\n";
|
||||
Stream << kIndent << "using namespace __llvm_libc::" << FI.ElementClass
|
||||
Stream << kIndent << "using namespace LIBC_NAMESPACE::" << FI.ElementClass
|
||||
<< ";\n";
|
||||
for (const auto &I : FI.Individuals)
|
||||
if (I.Element.Size == 0)
|
||||
@ -428,7 +428,7 @@ namespace configurations {
|
||||
// ------------------------------------------------------------
|
||||
// e.g.
|
||||
// llvm::ArrayRef<MemcpyConfiguration> getMemcpyConfigurations() {
|
||||
// using namespace __llvm_libc;
|
||||
// using namespace LIBC_NAMESPACE;
|
||||
// static constexpr MemcpyConfiguration kConfigurations[] = {
|
||||
// {Wrap<memcpy_0xE00E29EE73994E2B>, "memcpy_0xE00E29EE73994E2B"},
|
||||
// {Wrap<memcpy_0x8661D80472487AB5>, "memcpy_0x8661D80472487AB5"},
|
||||
@ -504,7 +504,7 @@ static raw_ostream &operator<<(raw_ostream &Stream, const Configuration &C) {
|
||||
if (C.Descriptors.empty())
|
||||
Stream << kIndent << "return {};\n";
|
||||
else {
|
||||
Stream << kIndent << "using namespace __llvm_libc;\n";
|
||||
Stream << kIndent << "using namespace LIBC_NAMESPACE;\n";
|
||||
Stream << kIndent << "static constexpr " << C.Type
|
||||
<< " kConfigurations[] = {\n";
|
||||
Stream << C.Descriptors;
|
||||
@ -542,11 +542,11 @@ static void Serialize(raw_ostream &Stream,
|
||||
Stream << "using llvm::libc_benchmarks::MemmoveConfiguration;\n";
|
||||
Stream << "using llvm::libc_benchmarks::MemsetConfiguration;\n";
|
||||
Stream << "\n";
|
||||
Stream << "namespace __llvm_libc {\n";
|
||||
Stream << "namespace LIBC_NAMESPACE {\n";
|
||||
Stream << "\n";
|
||||
codegen::functions::Serialize(Stream, Descriptors);
|
||||
Stream << "\n";
|
||||
Stream << "} // namespace __llvm_libc\n";
|
||||
Stream << "} // namespace LIBC_NAMESPACE\n";
|
||||
Stream << "\n";
|
||||
Stream << "namespace llvm {\n";
|
||||
Stream << "namespace automemcpy {\n";
|
||||
|
@ -63,14 +63,14 @@ using llvm::libc_benchmarks::MemcpyConfiguration;
|
||||
using llvm::libc_benchmarks::MemmoveConfiguration;
|
||||
using llvm::libc_benchmarks::MemsetConfiguration;
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
|
||||
static void memcpy_0xE00E29EE73994E2B(char *__restrict dst, const char *__restrict src, size_t size) {
|
||||
using namespace __llvm_libc::x86;
|
||||
using namespace LIBC_NAMESPACE::x86;
|
||||
return copy<Accelerator>(dst, src, size);
|
||||
}
|
||||
static void memcpy_0x7381B60C7BE75EF9(char *__restrict dst, const char *__restrict src, size_t size) {
|
||||
using namespace __llvm_libc::x86;
|
||||
using namespace LIBC_NAMESPACE::x86;
|
||||
if(size == 0) return;
|
||||
if(size == 1) return copy<_1>(dst, src);
|
||||
if(size == 2) return copy<_2>(dst, src);
|
||||
@ -84,7 +84,7 @@ static void memcpy_0x7381B60C7BE75EF9(char *__restrict dst, const char *__restri
|
||||
return copy<Loop<_64>>(dst, src, size);
|
||||
}
|
||||
static int memcmp_0x348D7BA6DB0EE033(const char * lhs, const char * rhs, size_t size) {
|
||||
using namespace __llvm_libc::x86;
|
||||
using namespace LIBC_NAMESPACE::x86;
|
||||
if(size == 0) return 0;
|
||||
if(size == 1) return three_way_compare<_1>(lhs, rhs);
|
||||
if(size < 4) return three_way_compare<HeadTail<_2>>(lhs, rhs, size);
|
||||
@ -95,7 +95,7 @@ static int memcmp_0x348D7BA6DB0EE033(const char * lhs, const char * rhs, size_t
|
||||
return three_way_compare<Align<_16,Arg::Lhs>::Then<Loop<_16>>>(lhs, rhs, size);
|
||||
}
|
||||
static void memset_0x71E761699B999863(char * dst, int value, size_t size) {
|
||||
using namespace __llvm_libc::x86;
|
||||
using namespace LIBC_NAMESPACE::x86;
|
||||
if(size == 0) return;
|
||||
if(size == 1) return splat_set<_1>(dst, value);
|
||||
if(size < 4) return splat_set<HeadTail<_2>>(dst, value, size);
|
||||
@ -108,7 +108,7 @@ static void memset_0x71E761699B999863(char * dst, int value, size_t size) {
|
||||
return splat_set<Align<_16,Arg::Dst>::Then<Loop<_32>>>(dst, value, size);
|
||||
}
|
||||
static void memset_0x3DF0F44E2ED6A50F(char * dst, int value, size_t size) {
|
||||
using namespace __llvm_libc::x86;
|
||||
using namespace LIBC_NAMESPACE::x86;
|
||||
if(size == 0) return;
|
||||
if(size == 1) return splat_set<_1>(dst, value);
|
||||
if(size < 4) return splat_set<HeadTail<_2>>(dst, value, size);
|
||||
@ -121,7 +121,7 @@ static void memset_0x3DF0F44E2ED6A50F(char * dst, int value, size_t size) {
|
||||
return splat_set<Align<_32,Arg::Dst>::Then<Loop<_32>>>(dst, value, size);
|
||||
}
|
||||
static void bzero_0x475977492C218AD4(char * dst, size_t size) {
|
||||
using namespace __llvm_libc::x86;
|
||||
using namespace LIBC_NAMESPACE::x86;
|
||||
if(size == 0) return;
|
||||
if(size == 1) return splat_set<_1>(dst, 0);
|
||||
if(size == 2) return splat_set<_2>(dst, 0);
|
||||
@ -134,7 +134,7 @@ static void bzero_0x475977492C218AD4(char * dst, size_t size) {
|
||||
return splat_set<Align<_32,Arg::Dst>::Then<Loop<_32>>>(dst, 0, size);
|
||||
}
|
||||
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
namespace llvm {
|
||||
namespace automemcpy {
|
||||
@ -163,7 +163,7 @@ void *Wrap(void *__restrict dst, const void *__restrict src, size_t size) {
|
||||
return dst;
|
||||
}
|
||||
llvm::ArrayRef<MemcpyConfiguration> getMemcpyConfigurations() {
|
||||
using namespace __llvm_libc;
|
||||
using namespace LIBC_NAMESPACE;
|
||||
static constexpr MemcpyConfiguration kConfigurations[] = {
|
||||
{Wrap<memcpy_0xE00E29EE73994E2B>, "memcpy_0xE00E29EE73994E2B"},
|
||||
{Wrap<memcpy_0x7381B60C7BE75EF9>, "memcpy_0x7381B60C7BE75EF9"},
|
||||
@ -178,7 +178,7 @@ int Wrap(const void *lhs, const void *rhs, size_t size) {
|
||||
reinterpret_cast<const char *>(rhs), size);
|
||||
}
|
||||
llvm::ArrayRef<MemcmpOrBcmpConfiguration> getMemcmpConfigurations() {
|
||||
using namespace __llvm_libc;
|
||||
using namespace LIBC_NAMESPACE;
|
||||
static constexpr MemcmpOrBcmpConfiguration kConfigurations[] = {
|
||||
{Wrap<memcmp_0x348D7BA6DB0EE033>, "memcmp_0x348D7BA6DB0EE033"},
|
||||
};
|
||||
@ -194,7 +194,7 @@ template <MemsetStub Foo> void *Wrap(void *dst, int value, size_t size) {
|
||||
return dst;
|
||||
}
|
||||
llvm::ArrayRef<MemsetConfiguration> getMemsetConfigurations() {
|
||||
using namespace __llvm_libc;
|
||||
using namespace LIBC_NAMESPACE;
|
||||
static constexpr MemsetConfiguration kConfigurations[] = {
|
||||
{Wrap<memset_0x71E761699B999863>, "memset_0x71E761699B999863"},
|
||||
{Wrap<memset_0x3DF0F44E2ED6A50F>, "memset_0x3DF0F44E2ED6A50F"},
|
||||
@ -207,7 +207,7 @@ template <BzeroStub Foo> void Wrap(void *dst, size_t size) {
|
||||
Foo(reinterpret_cast<char *>(dst), size);
|
||||
}
|
||||
llvm::ArrayRef<BzeroConfiguration> getBzeroConfigurations() {
|
||||
using namespace __llvm_libc;
|
||||
using namespace LIBC_NAMESPACE;
|
||||
static constexpr BzeroConfiguration kConfigurations[] = {
|
||||
{Wrap<bzero_0x475977492C218AD4>, "bzero_0x475977492C218AD4"},
|
||||
};
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
|
||||
// Data structure to capture properties of the linux/ELF TLS image.
|
||||
struct TLSImage {
|
||||
@ -106,6 +106,6 @@ void init_tls(TLSDescriptor &tls);
|
||||
// Cleanup the TLS area as described in |tls_descriptor|.
|
||||
void cleanup_tls(uintptr_t tls_addr, uintptr_t tls_size);
|
||||
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_CONFIG_LINUX_APP_H
|
||||
|
@ -30,19 +30,19 @@ implementation-in-namespace
|
||||
---------------------------
|
||||
|
||||
It is part of our implementation standards that all implementation pieces live
|
||||
under the ``__llvm_libc`` namespace. This prevents pollution of the global
|
||||
under the ``LIBC_NAMESPACE`` namespace. This prevents pollution of the global
|
||||
namespace. Without a formal check to ensure this, an implementation might
|
||||
compile and pass unit tests, but not produce a usable libc function.
|
||||
|
||||
This check that ensures any function call resolves to a function within the
|
||||
``__llvm_libc`` namespace.
|
||||
``LIBC_NAMESPACE`` namespace.
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
// Correct: implementation inside the correct namespace.
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
void LLVM_LIBC_ENTRYPOINT(strcpy)(char *dest, const char *src) {}
|
||||
// Namespaces within __llvm_libc namespace are allowed.
|
||||
// Namespaces within LIBC_NAMESPACE namespace are allowed.
|
||||
namespace inner{
|
||||
int localVar = 0;
|
||||
}
|
||||
@ -67,7 +67,7 @@ creates some uncertainty about which library a call resolves to especially when
|
||||
a public header with non-namespaced functions like ``string.h`` is included.
|
||||
|
||||
This check ensures any function call resolves to a function within the
|
||||
__llvm_libc namespace.
|
||||
LIBC_NAMESPACE namespace.
|
||||
|
||||
There are exceptions for the following functions:
|
||||
``__errno_location`` so that ``errno`` can be set;
|
||||
@ -76,10 +76,10 @@ are always external and can be intercepted.
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
|
||||
// Allow calls with the fully qualified name.
|
||||
__llvm_libc::strlen("hello");
|
||||
LIBC_NAMESPACE::strlen("hello");
|
||||
|
||||
// Allow calls to compiler provided functions.
|
||||
(void)__builtin_abs(-1);
|
||||
@ -93,4 +93,4 @@ are always external and can be intercepted.
|
||||
// Allow calling into specific global functions (explained above)
|
||||
::malloc(10);
|
||||
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
@ -158,7 +158,7 @@ this:
|
||||
|
||||
...
|
||||
|
||||
__llvm_libc::AllocChecker ac;
|
||||
LIBC_NAMESPACE::AllocChecker ac;
|
||||
auto *obj = new (ac) Type(...);
|
||||
if (!ac) {
|
||||
// handle allocator failure.
|
||||
|
@ -33,17 +33,17 @@ example. The ``round`` function will be declared in an internal header file
|
||||
#ifndef LLVM_LIBC_SRC_MATH_ROUND_ROUND_H
|
||||
#define LLVM_LIBC_SRC_MATH_ROUND_ROUND_H
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
|
||||
double round(double);
|
||||
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif LLVM_LIBC_SRC_MATH_ROUND_ROUND_H
|
||||
|
||||
Notice that the ``round`` function declaration is nested inside the namespace
|
||||
``__llvm_libc``. All implementation constructs in LLVM-libc are declared within
|
||||
the namespace ``__llvm_libc``.
|
||||
``LIBC_NAMESPACE``. All implementation constructs in LLVM-libc are declared within
|
||||
the namespace ``LIBC_NAMESPACE``.
|
||||
|
||||
``.cpp`` File Structure
|
||||
-----------------------
|
||||
@ -55,13 +55,13 @@ the entrypoint function should make use of a special macro. For example, the
|
||||
|
||||
// --- round.cpp --- //
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
|
||||
double LLVM_LIBC_ENTRYPOINT(round)(double d) {
|
||||
// ... implementation goes here.
|
||||
}
|
||||
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
Notice the use of the macro ``LLVM_LIBC_ENTRYPOINT``. This macro helps us define
|
||||
an C alias symbol for the C++ implementation. The C alias need not be added by
|
||||
|
@ -13,10 +13,11 @@
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
|
||||
template <typename T>
|
||||
__llvm_libc::cpp::enable_if_t<__llvm_libc::cpp::is_floating_point_v<T>, bool>
|
||||
LIBC_NAMESPACE::cpp::enable_if_t<LIBC_NAMESPACE::cpp::is_floating_point_v<T>,
|
||||
bool>
|
||||
ValuesEqual(T x1, T x2) {
|
||||
__llvm_libc::fputil::FPBits<T> bits1(x1);
|
||||
__llvm_libc::fputil::FPBits<T> bits2(x2);
|
||||
LIBC_NAMESPACE::fputil::FPBits<T> bits1(x1);
|
||||
LIBC_NAMESPACE::fputil::FPBits<T> bits2(x2);
|
||||
// If either is NaN, we want both to be NaN.
|
||||
if (bits1.is_nan() || bits2.is_nan())
|
||||
return bits2.is_nan() && bits2.is_nan();
|
||||
@ -26,7 +27,7 @@ ValuesEqual(T x1, T x2) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__llvm_libc::cpp::enable_if_t<__llvm_libc::cpp::is_integral_v<T>, bool>
|
||||
LIBC_NAMESPACE::cpp::enable_if_t<LIBC_NAMESPACE::cpp::is_integral_v<T>, bool>
|
||||
ValuesEqual(T x1, T x2) {
|
||||
return x1 == x2;
|
||||
}
|
||||
|
@ -44,8 +44,8 @@ void RemQuoDiff(RemQuoFunc<T> func1, RemQuoFunc<T> func2, const uint8_t *data,
|
||||
if ((q1 & 0x7) != (q2 & 0x7))
|
||||
__builtin_trap();
|
||||
|
||||
__llvm_libc::fputil::FPBits<T> bits1(remainder1);
|
||||
__llvm_libc::fputil::FPBits<T> bits2(remainder2);
|
||||
LIBC_NAMESPACE::fputil::FPBits<T> bits1(remainder1);
|
||||
LIBC_NAMESPACE::fputil::FPBits<T> bits2(remainder2);
|
||||
if (bits1.uintval() != bits2.uintval())
|
||||
__builtin_trap();
|
||||
}
|
||||
|
@ -70,83 +70,89 @@
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
|
||||
SingleInputSingleOutputDiff<float>(&__llvm_libc::ceilf, &::ceilf, data, size);
|
||||
SingleInputSingleOutputDiff<double>(&__llvm_libc::ceil, &::ceil, data, size);
|
||||
SingleInputSingleOutputDiff<long double>(&__llvm_libc::ceill, &::ceill, data,
|
||||
size);
|
||||
|
||||
SingleInputSingleOutputDiff<float>(&__llvm_libc::floorf, &::floorf, data,
|
||||
SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::ceilf, &::ceilf, data,
|
||||
size);
|
||||
SingleInputSingleOutputDiff<double>(&__llvm_libc::floor, &::floor, data,
|
||||
SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::ceil, &::ceil, data,
|
||||
size);
|
||||
SingleInputSingleOutputDiff<long double>(&__llvm_libc::floorl, &::floorl,
|
||||
SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::ceill, &::ceill,
|
||||
data, size);
|
||||
|
||||
SingleInputSingleOutputDiff<float>(&__llvm_libc::roundf, &::roundf, data,
|
||||
SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::floorf, &::floorf, data,
|
||||
size);
|
||||
SingleInputSingleOutputDiff<double>(&__llvm_libc::round, &::round, data,
|
||||
SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::floor, &::floor, data,
|
||||
size);
|
||||
SingleInputSingleOutputDiff<long double>(&__llvm_libc::roundl, &::roundl,
|
||||
SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::floorl, &::floorl,
|
||||
data, size);
|
||||
|
||||
SingleInputSingleOutputDiff<float>(&__llvm_libc::truncf, &::truncf, data,
|
||||
SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::roundf, &::roundf, data,
|
||||
size);
|
||||
SingleInputSingleOutputDiff<double>(&__llvm_libc::trunc, &::trunc, data,
|
||||
SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::round, &::round, data,
|
||||
size);
|
||||
SingleInputSingleOutputDiff<long double>(&__llvm_libc::truncl, &::truncl,
|
||||
SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::roundl, &::roundl,
|
||||
data, size);
|
||||
|
||||
SingleInputSingleOutputDiff<float>(&__llvm_libc::logbf, &::logbf, data, size);
|
||||
SingleInputSingleOutputDiff<double>(&__llvm_libc::logb, &::logb, data, size);
|
||||
SingleInputSingleOutputDiff<long double>(&__llvm_libc::logbl, &::logbl, data,
|
||||
size);
|
||||
SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::truncf, &::truncf, data,
|
||||
size);
|
||||
SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::trunc, &::trunc, data,
|
||||
size);
|
||||
SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::truncl, &::truncl,
|
||||
data, size);
|
||||
|
||||
TwoInputSingleOutputDiff<float, float>(&__llvm_libc::hypotf, &::hypotf, data,
|
||||
size);
|
||||
SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::logbf, &::logbf, data,
|
||||
size);
|
||||
SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::logb, &::logb, data,
|
||||
size);
|
||||
SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::logbl, &::logbl,
|
||||
data, size);
|
||||
|
||||
TwoInputSingleOutputDiff<float, float>(&__llvm_libc::remainderf,
|
||||
TwoInputSingleOutputDiff<float, float>(&LIBC_NAMESPACE::hypotf, &::hypotf,
|
||||
data, size);
|
||||
|
||||
TwoInputSingleOutputDiff<float, float>(&LIBC_NAMESPACE::remainderf,
|
||||
&::remainderf, data, size);
|
||||
TwoInputSingleOutputDiff<double, double>(&__llvm_libc::remainder,
|
||||
TwoInputSingleOutputDiff<double, double>(&LIBC_NAMESPACE::remainder,
|
||||
&::remainder, data, size);
|
||||
TwoInputSingleOutputDiff<long double, long double>(&__llvm_libc::remainderl,
|
||||
&::remainderl, data, size);
|
||||
TwoInputSingleOutputDiff<long double, long double>(
|
||||
&LIBC_NAMESPACE::remainderl, &::remainderl, data, size);
|
||||
|
||||
TwoInputSingleOutputDiff<float, float>(&__llvm_libc::fdimf, &::fdimf, data,
|
||||
TwoInputSingleOutputDiff<float, float>(&LIBC_NAMESPACE::fdimf, &::fdimf, data,
|
||||
size);
|
||||
TwoInputSingleOutputDiff<double, double>(&__llvm_libc::fdim, &::fdim, data,
|
||||
TwoInputSingleOutputDiff<double, double>(&LIBC_NAMESPACE::fdim, &::fdim, data,
|
||||
size);
|
||||
TwoInputSingleOutputDiff<long double, long double>(&__llvm_libc::fdiml,
|
||||
TwoInputSingleOutputDiff<long double, long double>(&LIBC_NAMESPACE::fdiml,
|
||||
&::fdiml, data, size);
|
||||
|
||||
SingleInputSingleOutputDiff<float>(&__llvm_libc::sqrtf, &::sqrtf, data, size);
|
||||
SingleInputSingleOutputDiff<double>(&__llvm_libc::sqrt, &::sqrt, data, size);
|
||||
SingleInputSingleOutputDiff<long double>(&__llvm_libc::sqrtl, &::sqrtl, data,
|
||||
size);
|
||||
SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::sqrtf, &::sqrtf, data,
|
||||
size);
|
||||
SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::sqrt, &::sqrt, data,
|
||||
size);
|
||||
SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::sqrtl, &::sqrtl,
|
||||
data, size);
|
||||
|
||||
SingleInputSingleOutputWithSideEffectDiff<float, int>(&__llvm_libc::frexpf,
|
||||
SingleInputSingleOutputWithSideEffectDiff<float, int>(&LIBC_NAMESPACE::frexpf,
|
||||
&::frexpf, data, size);
|
||||
SingleInputSingleOutputWithSideEffectDiff<double, int>(&__llvm_libc::frexp,
|
||||
SingleInputSingleOutputWithSideEffectDiff<double, int>(&LIBC_NAMESPACE::frexp,
|
||||
&::frexp, data, size);
|
||||
SingleInputSingleOutputWithSideEffectDiff<long double, int>(
|
||||
&__llvm_libc::frexpl, &::frexpl, data, size);
|
||||
&LIBC_NAMESPACE::frexpl, &::frexpl, data, size);
|
||||
|
||||
SingleInputSingleOutputWithSideEffectDiff<float, float>(&__llvm_libc::modff,
|
||||
&::modff, data, size);
|
||||
SingleInputSingleOutputWithSideEffectDiff<float, float>(
|
||||
&LIBC_NAMESPACE::modff, &::modff, data, size);
|
||||
SingleInputSingleOutputWithSideEffectDiff<double, double>(
|
||||
&__llvm_libc::modf, &::modf, data, size);
|
||||
&LIBC_NAMESPACE::modf, &::modf, data, size);
|
||||
SingleInputSingleOutputWithSideEffectDiff<long double, long double>(
|
||||
&__llvm_libc::modfl, &::modfl, data, size);
|
||||
&LIBC_NAMESPACE::modfl, &::modfl, data, size);
|
||||
|
||||
TwoInputSingleOutputDiff<float, int>(&__llvm_libc::ldexpf, &::ldexpf, data,
|
||||
TwoInputSingleOutputDiff<float, int>(&LIBC_NAMESPACE::ldexpf, &::ldexpf, data,
|
||||
size);
|
||||
TwoInputSingleOutputDiff<double, int>(&__llvm_libc::ldexp, &::ldexp, data,
|
||||
TwoInputSingleOutputDiff<double, int>(&LIBC_NAMESPACE::ldexp, &::ldexp, data,
|
||||
size);
|
||||
TwoInputSingleOutputDiff<long double, int>(&__llvm_libc::ldexpl, &::ldexpl,
|
||||
TwoInputSingleOutputDiff<long double, int>(&LIBC_NAMESPACE::ldexpl, &::ldexpl,
|
||||
data, size);
|
||||
|
||||
RemQuoDiff<float>(&__llvm_libc::remquof, &::remquof, data, size);
|
||||
RemQuoDiff<double>(&__llvm_libc::remquo, &::remquo, data, size);
|
||||
RemQuoDiff<long double>(&__llvm_libc::remquol, &::remquol, data, size);
|
||||
RemQuoDiff<float>(&LIBC_NAMESPACE::remquof, &::remquof, data, size);
|
||||
RemQuoDiff<double>(&LIBC_NAMESPACE::remquo, &::remquo, data, size);
|
||||
RemQuoDiff<long double>(&LIBC_NAMESPACE::remquol, &::remquol, data, size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -18,9 +18,9 @@
|
||||
#include "src/math/nextafterl.h"
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
TwoInputSingleOutputDiff<float, float>(&__llvm_libc::nextafterf,
|
||||
TwoInputSingleOutputDiff<float, float>(&LIBC_NAMESPACE::nextafterf,
|
||||
&::nextafterf, data, size);
|
||||
TwoInputSingleOutputDiff<double, double>(&__llvm_libc::nextafter,
|
||||
TwoInputSingleOutputDiff<double, double>(&LIBC_NAMESPACE::nextafter,
|
||||
&::nextafter, data, size);
|
||||
return 0;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ enum class TestResult {
|
||||
|
||||
inline TestResult test_vals(const char *fmt, double num, int prec, int width) {
|
||||
// Call snprintf on a nullptr to get the buffer size.
|
||||
int buffer_size = __llvm_libc::snprintf(nullptr, 0, fmt, width, prec, num);
|
||||
int buffer_size = LIBC_NAMESPACE::snprintf(nullptr, 0, fmt, width, prec, num);
|
||||
|
||||
if (buffer_size < 0) {
|
||||
return TestResult::BufferSizeFailed;
|
||||
@ -50,8 +50,8 @@ inline TestResult test_vals(const char *fmt, double num, int prec, int width) {
|
||||
int test_result = 0;
|
||||
int reference_result = 0;
|
||||
|
||||
test_result =
|
||||
__llvm_libc::snprintf(test_buff, buffer_size + 1, fmt, width, prec, num);
|
||||
test_result = LIBC_NAMESPACE::snprintf(test_buff, buffer_size + 1, fmt, width,
|
||||
prec, num);
|
||||
reference_result =
|
||||
mpfr_snprintf(reference_buff, buffer_size + 1, fmt, width, prec, num);
|
||||
|
||||
@ -84,7 +84,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
int prec = 0;
|
||||
int width = 0;
|
||||
|
||||
__llvm_libc::fputil::FPBits<double>::UIntType raw_num = 0;
|
||||
LIBC_NAMESPACE::fputil::FPBits<double>::UIntType raw_num = 0;
|
||||
|
||||
// Copy as many bytes of data as will fit into num, prec, and with. Any extras
|
||||
// are ignored.
|
||||
@ -98,7 +98,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
}
|
||||
}
|
||||
|
||||
num = __llvm_libc::fputil::FPBits<double>(raw_num).get_val();
|
||||
num = LIBC_NAMESPACE::fputil::FPBits<double>(raw_num).get_val();
|
||||
|
||||
if (width > MAX_SIZE) {
|
||||
width = MAX_SIZE;
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
using namespace __llvm_libc;
|
||||
using namespace LIBC_NAMESPACE;
|
||||
|
||||
// The design for the printf parser fuzzer is fairly simple. The parser uses a
|
||||
// mock arg list that will never fail, and is passed a randomized string. The
|
||||
|
@ -26,7 +26,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
container[i] = data[i];
|
||||
container[size] = '\0'; // Add null terminator to container.
|
||||
|
||||
StringParserOutputDiff<double>(&__llvm_libc::atof, &::atof, container, size);
|
||||
StringParserOutputDiff<double>(&LIBC_NAMESPACE::atof, &::atof, container,
|
||||
size);
|
||||
delete[] container;
|
||||
return 0;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
for (size_t i = 0; i < array_size; ++i)
|
||||
array[i] = data_as_int[i];
|
||||
|
||||
__llvm_libc::qsort(array, array_size, sizeof(int), int_compare);
|
||||
LIBC_NAMESPACE::qsort(array, array_size, sizeof(int), int_compare);
|
||||
|
||||
for (size_t i = 0; i < array_size - 1; ++i) {
|
||||
if (array[i] > array[i + 1])
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "utils/MPFRWrapper/mpfr_inc.h"
|
||||
|
||||
using __llvm_libc::fputil::FloatProperties;
|
||||
using LIBC_NAMESPACE::fputil::FloatProperties;
|
||||
|
||||
// This function calculates the effective precision for a given float type and
|
||||
// exponent. Subnormals have a lower effective precision since they don't
|
||||
@ -113,7 +113,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
mpfr_init2(mpfr_float, float_precision);
|
||||
mpfr_strtofr(mpfr_float, str_ptr, &out_ptr, base, MPFR_RNDN);
|
||||
float volatile float_result = mpfr_get_flt(mpfr_float, MPFR_RNDN);
|
||||
auto volatile strtof_result = __llvm_libc::strtof(str_ptr, &out_ptr);
|
||||
auto volatile strtof_result = LIBC_NAMESPACE::strtof(str_ptr, &out_ptr);
|
||||
ptrdiff_t strtof_strlen = out_ptr - str_ptr;
|
||||
if (result_strlen != strtof_strlen)
|
||||
__builtin_trap();
|
||||
@ -132,8 +132,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
mpfr_init2(mpfr_double, double_precision);
|
||||
mpfr_strtofr(mpfr_double, str_ptr, &out_ptr, base, MPFR_RNDN);
|
||||
double volatile double_result = mpfr_get_d(mpfr_double, MPFR_RNDN);
|
||||
auto volatile strtod_result = __llvm_libc::strtod(str_ptr, &out_ptr);
|
||||
auto volatile atof_result = __llvm_libc::atof(str_ptr);
|
||||
auto volatile strtod_result = LIBC_NAMESPACE::strtod(str_ptr, &out_ptr);
|
||||
auto volatile atof_result = LIBC_NAMESPACE::atof(str_ptr);
|
||||
ptrdiff_t strtod_strlen = out_ptr - str_ptr;
|
||||
if (result_strlen != strtod_strlen)
|
||||
__builtin_trap();
|
||||
@ -153,7 +153,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
mpfr_strtofr(mpfr_long_double, str_ptr, &out_ptr, base, MPFR_RNDN);
|
||||
long double volatile long_double_result =
|
||||
mpfr_get_ld(mpfr_long_double, MPFR_RNDN);
|
||||
auto volatile strtold_result = __llvm_libc::strtold(str_ptr, &out_ptr);
|
||||
auto volatile strtold_result = LIBC_NAMESPACE::strtold(str_ptr, &out_ptr);
|
||||
ptrdiff_t strtold_strlen = out_ptr - str_ptr;
|
||||
if (result_strlen != strtold_strlen)
|
||||
__builtin_trap();
|
||||
|
@ -61,19 +61,19 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
// random even when the input is cleaned.
|
||||
container[0] = data[0];
|
||||
|
||||
StringParserOutputDiff<int>(&__llvm_libc::atoi, &::atoi, container, size);
|
||||
StringParserOutputDiff<long>(&__llvm_libc::atol, &::atol, container, size);
|
||||
StringParserOutputDiff<long long>(&__llvm_libc::atoll, &::atoll, container,
|
||||
StringParserOutputDiff<int>(&LIBC_NAMESPACE::atoi, &::atoi, container, size);
|
||||
StringParserOutputDiff<long>(&LIBC_NAMESPACE::atol, &::atol, container, size);
|
||||
StringParserOutputDiff<long long>(&LIBC_NAMESPACE::atoll, &::atoll, container,
|
||||
size);
|
||||
|
||||
StringToNumberOutputDiff<long>(&__llvm_libc::strtol, &::strtol, container,
|
||||
StringToNumberOutputDiff<long>(&LIBC_NAMESPACE::strtol, &::strtol, container,
|
||||
size);
|
||||
StringToNumberOutputDiff<long long>(&__llvm_libc::strtoll, &::strtoll,
|
||||
StringToNumberOutputDiff<long long>(&LIBC_NAMESPACE::strtoll, &::strtoll,
|
||||
container, size);
|
||||
|
||||
StringToNumberOutputDiff<unsigned long>(&__llvm_libc::strtoul, &::strtoul,
|
||||
StringToNumberOutputDiff<unsigned long>(&LIBC_NAMESPACE::strtoul, &::strtoul,
|
||||
container, size);
|
||||
StringToNumberOutputDiff<unsigned long long>(&__llvm_libc::strtoull,
|
||||
StringToNumberOutputDiff<unsigned long long>(&LIBC_NAMESPACE::strtoull,
|
||||
&::strtoull, container, size);
|
||||
|
||||
delete[] container;
|
||||
|
@ -48,20 +48,22 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
|
||||
char *out_ptr = nullptr;
|
||||
|
||||
auto volatile atoi_output = __llvm_libc::atoi(str_ptr);
|
||||
auto volatile atol_output = __llvm_libc::atol(str_ptr);
|
||||
auto volatile atoll_output = __llvm_libc::atoll(str_ptr);
|
||||
auto volatile strtol_output = __llvm_libc::strtol(str_ptr, &out_ptr, base);
|
||||
auto volatile atoi_output = LIBC_NAMESPACE::atoi(str_ptr);
|
||||
auto volatile atol_output = LIBC_NAMESPACE::atol(str_ptr);
|
||||
auto volatile atoll_output = LIBC_NAMESPACE::atoll(str_ptr);
|
||||
auto volatile strtol_output = LIBC_NAMESPACE::strtol(str_ptr, &out_ptr, base);
|
||||
if (str_ptr + container_size - 1 < out_ptr)
|
||||
__builtin_trap();
|
||||
auto volatile strtoll_output = __llvm_libc::strtoll(str_ptr, &out_ptr, base);
|
||||
auto volatile strtoll_output =
|
||||
LIBC_NAMESPACE::strtoll(str_ptr, &out_ptr, base);
|
||||
if (str_ptr + container_size - 1 < out_ptr)
|
||||
__builtin_trap();
|
||||
auto volatile strtoul_output = __llvm_libc::strtoul(str_ptr, &out_ptr, base);
|
||||
auto volatile strtoul_output =
|
||||
LIBC_NAMESPACE::strtoul(str_ptr, &out_ptr, base);
|
||||
if (str_ptr + container_size - 1 < out_ptr)
|
||||
__builtin_trap();
|
||||
auto volatile strtoull_output =
|
||||
__llvm_libc::strtoull(str_ptr, &out_ptr, base);
|
||||
LIBC_NAMESPACE::strtoull(str_ptr, &out_ptr, base);
|
||||
if (str_ptr + container_size - 1 < out_ptr)
|
||||
__builtin_trap();
|
||||
|
||||
|
@ -64,12 +64,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
// The expected result should be the difference between the first non-equal
|
||||
// characters of s1 and s2. If all characters are equal, the expected result
|
||||
// should be '\0' - '\0' = 0.
|
||||
if (__llvm_libc::strcmp(s1, s2) != ch1 - ch2)
|
||||
if (LIBC_NAMESPACE::strcmp(s1, s2) != ch1 - ch2)
|
||||
__builtin_trap();
|
||||
|
||||
// Verify reversed operands. This should be the negated value of the previous
|
||||
// result, except of course if the previous result was zero.
|
||||
if (__llvm_libc::strcmp(s2, s1) != ch2 - ch1)
|
||||
if (LIBC_NAMESPACE::strcmp(s2, s1) != ch2 - ch1)
|
||||
__builtin_trap();
|
||||
|
||||
delete[] data1;
|
||||
|
@ -21,7 +21,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
char *dest = new char[size];
|
||||
if (!dest) __builtin_trap();
|
||||
|
||||
__llvm_libc::strcpy(dest, src);
|
||||
LIBC_NAMESPACE::strcpy(dest, src);
|
||||
|
||||
size_t i;
|
||||
for (i = 0; src[i] != '\0'; i++) {
|
||||
|
@ -54,11 +54,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
|
||||
const char *needle = reinterpret_cast<const char *>(container);
|
||||
const char *haystack = reinterpret_cast<const char *>(data + i);
|
||||
const char *result = __llvm_libc::strstr(haystack, needle);
|
||||
const char *result = LIBC_NAMESPACE::strstr(haystack, needle);
|
||||
|
||||
// A null terminator may exist earlier in each, so this needs to be recorded.
|
||||
const size_t haystack_size = __llvm_libc::strlen(haystack);
|
||||
const size_t needle_size = __llvm_libc::strlen(needle);
|
||||
const size_t haystack_size = LIBC_NAMESPACE::strlen(haystack);
|
||||
const size_t needle_size = LIBC_NAMESPACE::strlen(needle);
|
||||
|
||||
if (result) {
|
||||
// The needle is in the haystack.
|
||||
|
@ -8,6 +8,6 @@ be followed for future changes and additions:
|
||||
and free standing C headers.
|
||||
2. Free standing C headers are to be included as C headers and not as C++
|
||||
headers. That is, use `#include <stddef.h>` and not `#include <cstddef>`.
|
||||
3. The utilities should be defined in the namespace `__llvm_libc::cpp`. The
|
||||
3. The utilities should be defined in the namespace `LIBC_NAMESPACE::cpp`. The
|
||||
higher level namespace should have a `__` prefix to avoid symbol name pollution
|
||||
when the utilities are used in implementation of public functions.
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "src/__support/macros/attributes.h" // LIBC_INLINE
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
namespace cpp {
|
||||
|
||||
template <class T> LIBC_INLINE constexpr const T &max(const T &a, const T &b) {
|
||||
@ -26,6 +26,6 @@ template <class T> LIBC_INLINE constexpr const T &min(const T &a, const T &b) {
|
||||
}
|
||||
|
||||
} // namespace cpp
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ALGORITHM_H
|
||||
|
@ -12,11 +12,12 @@
|
||||
#include "src/__support/macros/attributes.h"
|
||||
#include <stddef.h> // For size_t.
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
namespace cpp {
|
||||
|
||||
template <class T, size_t N> struct array {
|
||||
static_assert(N != 0, "Cannot create a __llvm_libc::cpp::array of size 0.");
|
||||
static_assert(N != 0,
|
||||
"Cannot create a LIBC_NAMESPACE::cpp::array of size 0.");
|
||||
|
||||
T Data[N];
|
||||
using value_type = T;
|
||||
@ -50,6 +51,6 @@ template <class T, size_t N> struct array {
|
||||
};
|
||||
|
||||
} // namespace cpp
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ARRAY_H
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "type_traits.h"
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
namespace cpp {
|
||||
|
||||
enum class MemoryOrder : int {
|
||||
@ -116,6 +116,6 @@ LIBC_INLINE void atomic_thread_fence(MemoryOrder mem_ord) {
|
||||
}
|
||||
|
||||
} // namespace cpp
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ATOMIC_H
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "src/__support/macros/attributes.h"
|
||||
#include "src/__support/macros/config.h" // LIBC_HAS_BUILTIN
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
#if LIBC_HAS_BUILTIN(__builtin_bit_cast)
|
||||
#define LLVM_LIBC_HAS_BUILTIN_BIT_CAST
|
||||
@ -59,6 +59,6 @@ LIBC_INLINE constexpr To bit_or_static_cast(const From &from) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_BIT_H
|
||||
|
@ -12,11 +12,11 @@
|
||||
#include "src/__support/macros/attributes.h"
|
||||
#include <stddef.h> // For size_t.
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
template <size_t NumberOfBits> struct bitset {
|
||||
static_assert(NumberOfBits != 0,
|
||||
"Cannot create a __llvm_libc::cpp::bitset of size 0.");
|
||||
"Cannot create a LIBC_NAMESPACE::cpp::bitset of size 0.");
|
||||
|
||||
LIBC_INLINE constexpr void set(size_t Index) {
|
||||
Data[Index / BITS_PER_UNIT] |= mask(Index);
|
||||
@ -85,6 +85,6 @@ private:
|
||||
size_t Data[NUMBER_OF_UNITS] = {0};
|
||||
};
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_BITSET_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "src/__support/macros/attributes.h"
|
||||
#include "type_traits.h" // For enable_if_t, is_integral_v.
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
enum class byte : unsigned char {};
|
||||
|
||||
@ -66,6 +66,6 @@ to_integer(byte b) noexcept {
|
||||
return static_cast<IntegerType>(b);
|
||||
}
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_CSTDDEF_H
|
||||
|
@ -9,7 +9,7 @@
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_EXPECTED_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_CPP_EXPECTED_H
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// This is used to hold an unexpected value so that a different constructor is
|
||||
// selected.
|
||||
@ -46,6 +46,6 @@ public:
|
||||
constexpr const T *operator->() const { return &exp; }
|
||||
};
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_EXPECTED_H
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
namespace cpp {
|
||||
|
||||
/// A function type adapted from LLVM's function_ref.
|
||||
@ -65,6 +65,6 @@ public:
|
||||
};
|
||||
|
||||
} // namespace cpp
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_FUNCTIONAL_H
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
namespace cpp {
|
||||
|
||||
// Some older gcc distributions don't define these for 32 bit targets.
|
||||
@ -96,6 +96,6 @@ public:
|
||||
#endif
|
||||
|
||||
} // namespace cpp
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_LIMITS_H
|
||||
|
@ -23,7 +23,7 @@ enum class align_val_t : size_t {};
|
||||
|
||||
} // namespace std
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
|
||||
class AllocChecker {
|
||||
bool success = false;
|
||||
@ -52,26 +52,26 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
LIBC_INLINE void *operator new(size_t size,
|
||||
__llvm_libc::AllocChecker &ac) noexcept {
|
||||
return __llvm_libc::AllocChecker::alloc(size, ac);
|
||||
LIBC_NAMESPACE::AllocChecker &ac) noexcept {
|
||||
return LIBC_NAMESPACE::AllocChecker::alloc(size, ac);
|
||||
}
|
||||
|
||||
LIBC_INLINE void *operator new(size_t size, std::align_val_t align,
|
||||
__llvm_libc::AllocChecker &ac) noexcept {
|
||||
return __llvm_libc::AllocChecker::aligned_alloc(size, align, ac);
|
||||
LIBC_NAMESPACE::AllocChecker &ac) noexcept {
|
||||
return LIBC_NAMESPACE::AllocChecker::aligned_alloc(size, align, ac);
|
||||
}
|
||||
|
||||
LIBC_INLINE void *operator new[](size_t size,
|
||||
__llvm_libc::AllocChecker &ac) noexcept {
|
||||
return __llvm_libc::AllocChecker::alloc(size, ac);
|
||||
LIBC_NAMESPACE::AllocChecker &ac) noexcept {
|
||||
return LIBC_NAMESPACE::AllocChecker::alloc(size, ac);
|
||||
}
|
||||
|
||||
LIBC_INLINE void *operator new[](size_t size, std::align_val_t align,
|
||||
__llvm_libc::AllocChecker &ac) noexcept {
|
||||
return __llvm_libc::AllocChecker::aligned_alloc(size, align, ac);
|
||||
LIBC_NAMESPACE::AllocChecker &ac) noexcept {
|
||||
return LIBC_NAMESPACE::AllocChecker::aligned_alloc(size, align, ac);
|
||||
}
|
||||
|
||||
// The ideal situation would be to define the various flavors of operator delete
|
||||
@ -84,19 +84,19 @@ LIBC_INLINE void *operator new[](size_t size, std::align_val_t align,
|
||||
// they will replace operator delete for the entire application. Including this
|
||||
// header file in all libc source files where operator delete is called ensures
|
||||
// that only libc call sites use these replacement operator delete functions.
|
||||
void operator delete(void *) noexcept __asm__("__llvm_libc_delete");
|
||||
void operator delete(void *) noexcept __asm__("LIBC_NAMESPACE_delete");
|
||||
void operator delete(void *, std::align_val_t) noexcept
|
||||
__asm__("__llvm_libc_delete_aligned");
|
||||
__asm__("LIBC_NAMESPACE_delete_aligned");
|
||||
void operator delete(void *, size_t) noexcept
|
||||
__asm__("__llvm_libc_delete_sized");
|
||||
__asm__("LIBC_NAMESPACE_delete_sized");
|
||||
void operator delete(void *, size_t, std::align_val_t) noexcept
|
||||
__asm__("__llvm_libc_delete_sized_aligned");
|
||||
void operator delete[](void *) noexcept __asm__("__llvm_libc_delete_array");
|
||||
__asm__("LIBC_NAMESPACE_delete_sized_aligned");
|
||||
void operator delete[](void *) noexcept __asm__("LIBC_NAMESPACE_delete_array");
|
||||
void operator delete[](void *, std::align_val_t) noexcept
|
||||
__asm__("__llvm_libc_delete_array_aligned");
|
||||
__asm__("LIBC_NAMESPACE_delete_array_aligned");
|
||||
void operator delete[](void *, size_t) noexcept
|
||||
__asm__("__llvm_libc_delete_array_sized");
|
||||
__asm__("LIBC_NAMESPACE_delete_array_sized");
|
||||
void operator delete[](void *, size_t, std::align_val_t) noexcept
|
||||
__asm__("__llvm_libc_delete_array_sized_aligned");
|
||||
__asm__("LIBC_NAMESPACE_delete_array_sized_aligned");
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_NEW_H
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "src/__support/CPP/utility.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
namespace cpp {
|
||||
|
||||
// Trivial nullopt_t struct.
|
||||
@ -118,6 +118,6 @@ public:
|
||||
};
|
||||
|
||||
} // namespace cpp
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_OPTIONAL_H
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// A trimmed down implementation of std::span.
|
||||
// Missing features:
|
||||
@ -119,6 +119,6 @@ private:
|
||||
size_t span_size;
|
||||
};
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_SPAN_H
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <stddef.h> // size_t
|
||||
#include <stdlib.h> // malloc, free
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
namespace cpp {
|
||||
|
||||
// This class mimics std::string but does not intend to be a full fledged
|
||||
@ -61,7 +61,7 @@ public:
|
||||
LIBC_INLINE string(const string_view &view)
|
||||
: string(view.data(), view.size()) {}
|
||||
LIBC_INLINE string(const char *cstr)
|
||||
: string(cstr, ::__llvm_libc::internal::string_length(cstr)) {}
|
||||
: string(cstr, ::LIBC_NAMESPACE::internal::string_length(cstr)) {}
|
||||
LIBC_INLINE string(size_t size_, char value) {
|
||||
resize(size_);
|
||||
inline_memset((void *)buffer_, value, size_);
|
||||
@ -225,6 +225,6 @@ LIBC_INLINE string to_string(unsigned long long value) {
|
||||
// LIBC_INLINE string to_string(long double value);
|
||||
|
||||
} // namespace cpp
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_STRING_H
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
namespace cpp {
|
||||
|
||||
// This is very simple alternate of the std::string_view class. There is no
|
||||
@ -197,6 +197,6 @@ public:
|
||||
};
|
||||
|
||||
} // namespace cpp
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_STRING_VIEW_H
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "src/__support/integer_to_string.h"
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
namespace cpp {
|
||||
|
||||
// This class is to be used to write simple strings into a user provided buffer
|
||||
@ -90,6 +90,6 @@ public:
|
||||
};
|
||||
|
||||
} // namespace cpp
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_STRINGSTREAM_H
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "src/__support/CPP/type_traits/type_identity.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// add_lvalue_reference
|
||||
namespace detail {
|
||||
@ -25,6 +25,6 @@ struct add_lvalue_reference : decltype(detail::try_add_lvalue_reference<T>(0)) {
|
||||
template <class T>
|
||||
using add_lvalue_reference_t = typename add_lvalue_reference<T>::type;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_LVALUE_REFERENCE_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "src/__support/CPP/type_traits/type_identity.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// add_pointer
|
||||
namespace detail {
|
||||
@ -23,6 +23,6 @@ template <class T> auto try_add_pointer(...) -> cpp::type_identity<T>;
|
||||
template <class T>
|
||||
struct add_pointer : decltype(detail::try_add_pointer<T>(0)) {};
|
||||
template <class T> using add_pointer_t = typename add_pointer<T>::type;
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_POINTER_H
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "src/__support/CPP/type_traits/type_identity.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// add_rvalue_reference
|
||||
namespace detail {
|
||||
@ -24,6 +24,6 @@ struct add_rvalue_reference : decltype(detail::try_add_rvalue_reference<T>(0)) {
|
||||
template <class T>
|
||||
using add_rvalue_reference_t = typename add_rvalue_reference<T>::type;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_RVALUE_REFERENCE_H
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// This is technically not part of the standard but it come often enough that
|
||||
// it's convenient to have around.
|
||||
@ -24,6 +24,6 @@ namespace __llvm_libc::cpp {
|
||||
// Usage `static_assert(cpp::always_false<T>, "error message");`
|
||||
template <typename...> LIBC_INLINE_VAR constexpr bool always_false = false;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ALWAYS_FALSE_H
|
||||
|
@ -10,11 +10,11 @@
|
||||
|
||||
#include "src/__support/CPP/type_traits/integral_constant.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// bool_constant
|
||||
template <bool V> using bool_constant = cpp::integral_constant<bool, V>;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_BOOL_CONSTANT_H
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "src/__support/CPP/type_traits/type_identity.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// conditional
|
||||
template <bool B, typename T, typename F>
|
||||
@ -20,6 +20,6 @@ struct conditional<false, T, F> : type_identity<F> {};
|
||||
template <bool B, typename T, typename F>
|
||||
using conditional_t = typename conditional<B, T, F>::type;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_CONDITIONAL_H
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "src/__support/CPP/type_traits/remove_extent.h"
|
||||
#include "src/__support/CPP/type_traits/remove_reference.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// decay
|
||||
template <class T> class decay {
|
||||
@ -33,6 +33,6 @@ public:
|
||||
};
|
||||
template <class T> using decay_t = typename decay<T>::type;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_DECAY_H
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "src/__support/CPP/type_traits/type_identity.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// enable_if
|
||||
template <bool B, typename T = void> struct enable_if;
|
||||
@ -18,6 +18,6 @@ template <typename T> struct enable_if<true, T> : type_identity<T> {};
|
||||
template <bool B, typename T = void>
|
||||
using enable_if_t = typename enable_if<B, T>::type;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ENABLE_IF_H
|
||||
|
@ -10,11 +10,11 @@
|
||||
|
||||
#include "src/__support/CPP/type_traits/bool_constant.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// false_type
|
||||
using false_type = cpp::bool_constant<false>;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_FALSE_TYPE_H
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "src/__support/macros/attributes.h" // LIBC_INLINE_VAR
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// integral_constant
|
||||
template <typename T, T v> struct integral_constant {
|
||||
@ -18,6 +18,6 @@ template <typename T, T v> struct integral_constant {
|
||||
LIBC_INLINE_VAR static constexpr T value = v;
|
||||
};
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INTEGRAL_CONSTANT_H
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "src/__support/CPP/type_traits/is_same.h"
|
||||
#include "src/__support/CPP/utility/forward.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -57,6 +57,6 @@ decltype(auto) invoke(Function &&fun, Args &&...args) {
|
||||
cpp::forward<Function>(fun), cpp::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INVOKE_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "src/__support/CPP/type_traits/type_identity.h"
|
||||
#include "src/__support/CPP/utility/declval.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
template <class F, class... Args>
|
||||
struct invoke_result : cpp::type_identity<decltype(cpp::invoke(
|
||||
@ -21,6 +21,6 @@ struct invoke_result : cpp::type_identity<decltype(cpp::invoke(
|
||||
template <class F, class... Args>
|
||||
using invoke_result_t = typename invoke_result<F, Args...>::type;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INVOKE_RESULT_H
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "src/__support/CPP/type_traits/is_integral.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_arithmetic
|
||||
template <typename T>
|
||||
@ -22,6 +22,6 @@ struct is_arithmetic : cpp::bool_constant<(cpp::is_integral_v<T> ||
|
||||
template <typename T>
|
||||
LIBC_INLINE_VAR constexpr bool is_arithmetic_v = is_arithmetic<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ARITHMETIC_H
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include <stddef.h> // For size_t
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_array
|
||||
template <class T> struct is_array : false_type {};
|
||||
@ -23,6 +23,6 @@ template <class T, size_t N> struct is_array<T[N]> : true_type {};
|
||||
template <class T>
|
||||
LIBC_INLINE_VAR constexpr bool is_array_v = is_array<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ARRAY_H
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "src/__support/CPP/type_traits/true_type.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_base_of
|
||||
namespace detail {
|
||||
@ -39,6 +39,6 @@ struct is_base_of
|
||||
template <typename Base, typename Derived>
|
||||
LIBC_INLINE_VAR constexpr bool is_base_of_v = is_base_of<Base, Derived>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_BASE_OF_H
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "src/__support/CPP/type_traits/is_union.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_class
|
||||
namespace detail {
|
||||
@ -24,6 +24,6 @@ template <class T> struct is_class : decltype(detail::test<T>(nullptr)) {};
|
||||
template <typename T>
|
||||
LIBC_INLINE_VAR constexpr bool is_class_v = is_class<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CLASS_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "src/__support/CPP/type_traits/true_type.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_const
|
||||
template <class T> struct is_const : cpp::false_type {};
|
||||
@ -20,6 +20,6 @@ template <class T> struct is_const<const T> : cpp::true_type {};
|
||||
template <class T>
|
||||
LIBC_INLINE_VAR constexpr bool is_const_v = is_const<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONST_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "src/__support/CPP/utility/declval.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_convertible
|
||||
namespace detail {
|
||||
@ -40,6 +40,6 @@ template <class From, class To>
|
||||
LIBC_INLINE_VAR constexpr bool is_convertible_v =
|
||||
is_convertible<From, To>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONVERTIBLE_H
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "src/__support/macros/attributes.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_destructible
|
||||
#if LIBC_HAS_BUILTIN(__is_destructible)
|
||||
@ -61,6 +61,6 @@ template <> struct is_destructible<void> : public false_type {};
|
||||
template <class T>
|
||||
LIBC_INLINE_VAR constexpr bool is_destructible_v = is_destructible<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_DESTRUCTIBLE_H
|
||||
|
@ -11,13 +11,13 @@
|
||||
#include "src/__support/CPP/type_traits/bool_constant.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_enum
|
||||
template <typename T> struct is_enum : bool_constant<__is_enum(T)> {};
|
||||
template <typename T>
|
||||
LIBC_INLINE_VAR constexpr bool is_enum_v = is_enum<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ENUM_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "src/__support/CPP/type_traits/remove_cv.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_floating_point
|
||||
template <typename T> struct is_floating_point {
|
||||
@ -30,6 +30,6 @@ template <typename T>
|
||||
LIBC_INLINE_VAR constexpr bool is_floating_point_v =
|
||||
is_floating_point<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_FLOATING_POINT_H
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "src/__support/macros/attributes.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_function
|
||||
#if LIBC_HAS_BUILTIN(__is_function)
|
||||
@ -28,6 +28,6 @@ struct is_function
|
||||
template <class T>
|
||||
LIBC_INLINE_VAR constexpr bool is_function_v = is_function<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_FUNCTION_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "src/__support/CPP/type_traits/remove_cv.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_integral
|
||||
template <typename T> struct is_integral {
|
||||
@ -34,6 +34,6 @@ public:
|
||||
template <typename T>
|
||||
LIBC_INLINE_VAR constexpr bool is_integral_v = is_integral<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_INTEGRAL_H
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "src/__support/macros/attributes.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_lvalue_reference
|
||||
#if LIBC_HAS_BUILTIN(__is_lvalue_reference)
|
||||
@ -28,6 +28,6 @@ template <class T>
|
||||
LIBC_INLINE_VAR constexpr bool is_lvalue_reference_v =
|
||||
is_lvalue_reference<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_LVALUE_REFERENCE_H
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "src/__support/CPP/type_traits/true_type.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_member_pointer
|
||||
template <class T> struct is_member_pointer_helper : cpp::false_type {};
|
||||
@ -25,6 +25,6 @@ template <class T>
|
||||
LIBC_INLINE_VAR constexpr bool is_member_pointer_v =
|
||||
is_member_pointer<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_MEMBER_POINTER_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "src/__support/CPP/type_traits/remove_cv.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_null_pointer
|
||||
using nullptr_t = decltype(nullptr);
|
||||
@ -21,6 +21,6 @@ struct is_null_pointer : cpp::is_same<cpp::nullptr_t, cpp::remove_cv_t<T>> {};
|
||||
template <class T>
|
||||
LIBC_INLINE_VAR constexpr bool is_null_pointer_v = is_null_pointer<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_NULL_POINTER_H
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "src/__support/CPP/type_traits/is_union.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_object
|
||||
template <class T>
|
||||
@ -25,6 +25,6 @@ struct is_object
|
||||
template <class T>
|
||||
LIBC_INLINE_VAR constexpr bool is_object_v = is_object<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_OBJECT_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "src/__support/CPP/type_traits/true_type.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_pointer
|
||||
template <typename T> struct is_pointer : cpp::false_type {};
|
||||
@ -23,6 +23,6 @@ template <typename T> struct is_pointer<T *const volatile> : cpp::true_type {};
|
||||
template <typename T>
|
||||
LIBC_INLINE_VAR constexpr bool is_pointer_v = is_pointer<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_POINTER_H
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "src/__support/macros/attributes.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_reference
|
||||
#if LIBC_HAS_BUILTIN(__is_reference)
|
||||
@ -27,6 +27,6 @@ template <typename T> struct is_reference<T &&> : public true_type {};
|
||||
template <class T>
|
||||
LIBC_INLINE_VAR constexpr bool is_reference_v = is_reference<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_REFERENCE_H
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "src/__support/macros/attributes.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_rvalue_reference
|
||||
#if LIBC_HAS_BUILTIN(__is_rvalue_reference)
|
||||
@ -28,6 +28,6 @@ template <class T>
|
||||
LIBC_INLINE_VAR constexpr bool is_rvalue_reference_v =
|
||||
is_rvalue_reference<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_RVALUE_REFERENCE_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "src/__support/CPP/type_traits/true_type.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_same
|
||||
template <typename T, typename U> struct is_same : cpp::false_type {};
|
||||
@ -20,6 +20,6 @@ template <typename T> struct is_same<T, T> : cpp::true_type {};
|
||||
template <typename T, typename U>
|
||||
LIBC_INLINE_VAR constexpr bool is_same_v = is_same<T, U>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SAME_H
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "src/__support/CPP/type_traits/is_pointer.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_scalar
|
||||
template <class T>
|
||||
@ -27,6 +27,6 @@ struct is_scalar
|
||||
template <class T>
|
||||
LIBC_INLINE_VAR constexpr bool is_scalar_v = is_scalar<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SCALAR_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "src/__support/CPP/type_traits/is_arithmetic.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_signed
|
||||
template <typename T>
|
||||
@ -23,6 +23,6 @@ struct is_signed : bool_constant<(is_arithmetic_v<T> && (T(-1) < T(0)))> {
|
||||
template <typename T>
|
||||
LIBC_INLINE_VAR constexpr bool is_signed_v = is_signed<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SIGNED_H
|
||||
|
@ -10,13 +10,13 @@
|
||||
|
||||
#include "src/__support/CPP/type_traits/integral_constant.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_trivially_constructible
|
||||
template <class T, class... Args>
|
||||
struct is_trivially_constructible
|
||||
: integral_constant<bool, __is_trivially_constructible(T, Args...)> {};
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_CONSTRUCTIBLE_H
|
||||
|
@ -11,13 +11,13 @@
|
||||
#include "src/__support/CPP/type_traits/integral_constant.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_trivially_copyable
|
||||
template <class T>
|
||||
struct is_trivially_copyable
|
||||
: public integral_constant<bool, __is_trivially_copyable(T)> {};
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_COPYABLE_H
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "src/__support/macros/attributes.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_trivially_destructible
|
||||
#if LIBC_HAS_BUILTIN(__is_trivially_destructible)
|
||||
@ -30,6 +30,6 @@ template <typename T>
|
||||
LIBC_INLINE_VAR constexpr bool is_trivially_destructible_v =
|
||||
is_trivially_destructible<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_DESTRUCTIBLE_H
|
||||
|
@ -11,13 +11,13 @@
|
||||
#include "src/__support/CPP/type_traits/bool_constant.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_union
|
||||
template <class T> struct is_union : bool_constant<__is_union(T)> {};
|
||||
template <typename T>
|
||||
LIBC_INLINE_VAR constexpr bool is_union_v = is_union<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_UNION_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "src/__support/CPP/type_traits/is_arithmetic.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_unsigned
|
||||
template <typename T>
|
||||
@ -23,6 +23,6 @@ struct is_unsigned : bool_constant<(is_arithmetic_v<T> && (T(-1) > T(0)))> {
|
||||
template <typename T>
|
||||
LIBC_INLINE_VAR constexpr bool is_unsigned_v = is_unsigned<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_UNSIGNED_H
|
||||
|
@ -12,13 +12,13 @@
|
||||
#include "src/__support/CPP/type_traits/remove_cv.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// is_void
|
||||
template <typename T> struct is_void : is_same<void, remove_cv_t<T>> {};
|
||||
template <typename T>
|
||||
LIBC_INLINE_VAR constexpr bool is_void_v = is_void<T>::value;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_VOID_H
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "src/__support/CPP/type_traits/type_identity.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// make_signed
|
||||
template <typename T> struct make_signed;
|
||||
@ -32,6 +32,6 @@ template <> struct make_signed<__uint128_t> : type_identity<__int128_t> {};
|
||||
#endif
|
||||
template <typename T> using make_signed_t = typename make_signed<T>::type;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_SIGNED_H
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "src/__support/CPP/type_traits/type_identity.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// make_unsigned
|
||||
|
||||
@ -37,6 +37,6 @@ template <> struct make_unsigned<__uint128_t> : type_identity<__uint128_t> {};
|
||||
#endif
|
||||
template <typename T> using make_unsigned_t = typename make_unsigned<T>::type;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_UNSIGNED_H
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include <stddef.h> // size_t
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// remove_all_extents
|
||||
#if LIBC_HAS_BUILTIN(__remove_all_extents)
|
||||
@ -34,6 +34,6 @@ template <typename T>
|
||||
using remove_all_extents_t = typename remove_all_extents<T>::type;
|
||||
#endif
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_ALL_EXTENTS_H
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "src/__support/CPP/type_traits/type_identity.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// remove_cv
|
||||
template <class T> struct remove_cv : cpp::type_identity<T> {};
|
||||
@ -20,6 +20,6 @@ template <class T>
|
||||
struct remove_cv<const volatile T> : cpp::type_identity<T> {};
|
||||
template <class T> using remove_cv_t = typename remove_cv<T>::type;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_CV_H
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "src/__support/CPP/type_traits/remove_cv.h"
|
||||
#include "src/__support/CPP/type_traits/remove_reference.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// remove_cvref
|
||||
template <typename T> struct remove_cvref {
|
||||
@ -19,6 +19,6 @@ template <typename T> struct remove_cvref {
|
||||
};
|
||||
template <typename T> using remove_cvref_t = typename remove_cvref<T>::type;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_CVREF_H
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "src/__support/CPP/type_traits/type_identity.h"
|
||||
#include "stddef.h" // size_t
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// remove_extent
|
||||
template <class T> struct remove_extent : cpp::type_identity<T> {};
|
||||
@ -20,6 +20,6 @@ template <class T, size_t N>
|
||||
struct remove_extent<T[N]> : cpp::type_identity<T> {};
|
||||
template <class T> using remove_extent_t = typename remove_extent<T>::type;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_EXTENT_H
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "src/__support/CPP/type_traits/type_identity.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// remove_reference
|
||||
template <class T> struct remove_reference : cpp::type_identity<T> {};
|
||||
@ -19,6 +19,6 @@ template <class T> struct remove_reference<T &&> : cpp::type_identity<T> {};
|
||||
template <class T>
|
||||
using remove_reference_t = typename remove_reference<T>::type;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_REFERENCE_H
|
||||
|
@ -10,11 +10,11 @@
|
||||
|
||||
#include "src/__support/CPP/type_traits/bool_constant.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// true_type
|
||||
using true_type = cpp::bool_constant<true>;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TRUE_TYPE_H
|
||||
|
@ -8,13 +8,13 @@
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TYPE_IDENTITY_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TYPE_IDENTITY_H
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// type_identity
|
||||
template <typename T> struct type_identity {
|
||||
using type = T;
|
||||
};
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TYPE_IDENTITY_H
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "src/__support/CPP/type_traits/type_identity.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// void_t
|
||||
|
||||
@ -21,6 +21,6 @@ template <typename... Ts> struct make_void : cpp::type_identity<void> {};
|
||||
template <typename... Ts>
|
||||
using void_t = typename detail::make_void<Ts...>::type;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_VOID_T_H
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "src/__support/CPP/type_traits/add_rvalue_reference.h"
|
||||
#include "src/__support/CPP/type_traits/always_false.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// declval
|
||||
template <typename T> cpp::add_rvalue_reference_t<T> declval() {
|
||||
@ -19,6 +19,6 @@ template <typename T> cpp::add_rvalue_reference_t<T> declval() {
|
||||
"declval not allowed in an evaluated context");
|
||||
}
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_DECLVAL_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "src/__support/CPP/type_traits/remove_reference.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// forward
|
||||
template <typename T>
|
||||
@ -27,6 +27,6 @@ LIBC_INLINE constexpr T &&forward(remove_reference_t<T> &&value) {
|
||||
return static_cast<T &&>(value);
|
||||
}
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_FORWARD_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include <stddef.h> // size_t
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// in_place
|
||||
struct in_place_t {
|
||||
@ -31,6 +31,6 @@ template <size_t I> struct in_place_index_t {
|
||||
template <size_t I>
|
||||
LIBC_INLINE_VAR constexpr in_place_index_t<I> in_place_index{};
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_IN_PLACE_H
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "src/__support/CPP/type_traits/is_integral.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// integer_sequence
|
||||
template <typename T, T... Ints> struct integer_sequence {
|
||||
@ -32,6 +32,6 @@ template <typename T, int N>
|
||||
using make_integer_sequence =
|
||||
typename detail::make_integer_sequence<T, N - 1>::type;
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_INTEGER_SEQUENCE_H
|
||||
|
@ -10,13 +10,13 @@
|
||||
|
||||
#include "src/__support/CPP/type_traits/remove_reference.h"
|
||||
|
||||
namespace __llvm_libc::cpp {
|
||||
namespace LIBC_NAMESPACE::cpp {
|
||||
|
||||
// move
|
||||
template <class T> constexpr cpp::remove_reference_t<T> &&move(T &&t) {
|
||||
return static_cast<typename cpp::remove_reference_t<T> &&>(t);
|
||||
}
|
||||
|
||||
} // namespace __llvm_libc::cpp
|
||||
} // namespace LIBC_NAMESPACE::cpp
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_MOVE_H
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "src/__support/CPP/type_traits.h"
|
||||
#include "src/__support/common.h"
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
namespace fputil {
|
||||
|
||||
template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
|
||||
@ -76,6 +76,6 @@ LIBC_INLINE T fdim(T x, T y) {
|
||||
}
|
||||
|
||||
} // namespace fputil
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_BASICOPERATIONS_H
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "src/__support/CPP/type_traits.h"
|
||||
#include "src/__support/common.h"
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
namespace fputil {
|
||||
|
||||
static constexpr int QUOTIENT_LSB_BITS = 3;
|
||||
@ -35,7 +35,7 @@ LIBC_INLINE T remquo(T x, T y, int &q) {
|
||||
|
||||
if (xbits.is_zero()) {
|
||||
q = 0;
|
||||
return __llvm_libc::fputil::copysign(T(0.0), x);
|
||||
return LIBC_NAMESPACE::fputil::copysign(T(0.0), x);
|
||||
}
|
||||
|
||||
if (ybits.is_inf()) {
|
||||
@ -73,7 +73,7 @@ LIBC_INLINE T remquo(T x, T y, int &q) {
|
||||
mx = n - my;
|
||||
if (mx == 0) {
|
||||
q = result_sign ? -q : q;
|
||||
return __llvm_libc::fputil::copysign(T(0.0), x);
|
||||
return LIBC_NAMESPACE::fputil::copysign(T(0.0), x);
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,11 +109,11 @@ LIBC_INLINE T remquo(T x, T y, int &q) {
|
||||
|
||||
q = result_sign ? -q : q;
|
||||
if (native_remainder == T(0.0))
|
||||
return __llvm_libc::fputil::copysign(T(0.0), x);
|
||||
return LIBC_NAMESPACE::fputil::copysign(T(0.0), x);
|
||||
return native_remainder;
|
||||
}
|
||||
|
||||
} // namespace fputil
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_DIVISIONANDREMAINDEROPERATIONS_H
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "riscv64/FEnvImpl.h"
|
||||
#else
|
||||
|
||||
namespace __llvm_libc::fputil {
|
||||
namespace LIBC_NAMESPACE::fputil {
|
||||
|
||||
// All dummy functions silently succeed.
|
||||
|
||||
@ -64,10 +64,10 @@ LIBC_INLINE int get_env(fenv_t *) { return 0; }
|
||||
|
||||
LIBC_INLINE int set_env(const fenv_t *) { return 0; }
|
||||
|
||||
} // namespace __llvm_libc::fputil
|
||||
} // namespace LIBC_NAMESPACE::fputil
|
||||
#endif
|
||||
|
||||
namespace __llvm_libc::fputil {
|
||||
namespace LIBC_NAMESPACE::fputil {
|
||||
|
||||
LIBC_INLINE int set_except_if_required(int excepts) {
|
||||
if (math_errhandling & MATH_ERREXCEPT)
|
||||
@ -86,6 +86,6 @@ LIBC_INLINE void set_errno_if_required(int err) {
|
||||
libc_errno = err;
|
||||
}
|
||||
|
||||
} // namespace __llvm_libc::fputil
|
||||
} // namespace LIBC_NAMESPACE::fputil
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_FENVIMPL_H
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "generic/FMA.h"
|
||||
#include "src/__support/CPP/type_traits.h"
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
namespace fputil {
|
||||
|
||||
template <typename T> LIBC_INLINE T fma(T x, T y, T z) {
|
||||
@ -37,7 +37,7 @@ template <typename T> LIBC_INLINE T fma(T x, T y, T z) {
|
||||
}
|
||||
|
||||
} // namespace fputil
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "FloatProperties.h"
|
||||
#include <stdint.h>
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
namespace fputil {
|
||||
|
||||
template <typename T> struct MantissaWidth {
|
||||
@ -233,7 +233,7 @@ template <typename T> struct FPBits {
|
||||
};
|
||||
|
||||
} // namespace fputil
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#ifdef SPECIAL_X86_LONG_DOUBLE
|
||||
#include "x86_64/LongDoubleBits.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace __llvm_libc {
|
||||
namespace LIBC_NAMESPACE {
|
||||
namespace fputil {
|
||||
|
||||
template <typename T> struct FloatProperties {};
|
||||
@ -194,6 +194,6 @@ template <typename BitsType>
|
||||
using FloatTypeT = typename FloatType<BitsType>::Type;
|
||||
|
||||
} // namespace fputil
|
||||
} // namespace __llvm_libc
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_FLOATPROPERTIES_H
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user