[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)

This is a part of #97655.
This commit is contained in:
Petr Hosek 2024-07-12 09:28:41 -07:00 committed by GitHub
parent dd866040ae
commit 5ff3ff33ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2328 changed files with 7576 additions and 4679 deletions

View File

@ -1,8 +1,9 @@
#include "LibcFunctionPrototypes.h"
#include "src/__support/macros/config.h"
#include "llvm/ADT/ArrayRef.h"
#include <cstddef>
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
extern void *memcpy(void *__restrict, const void *__restrict, size_t);
extern void *memmove(void *, const void *, size_t);
@ -11,7 +12,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 LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
// List of implementations to test.

View File

@ -10,6 +10,7 @@
#include "LibcBenchmark.h"
#include "LibcMemoryBenchmark.h"
#include "MemorySizeDistributions.h"
#include "src/__support/macros/config.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
@ -21,7 +22,7 @@
#include <cstring>
#include <unistd.h>
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
extern void *memcpy(void *__restrict, const void *__restrict, size_t);
extern void *memmove(void *, const void *, size_t);
@ -30,7 +31,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 LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
namespace llvm {
namespace libc_benchmarks {

View File

@ -36,6 +36,7 @@
// function at the end of the file.
#include "automemcpy/CodeGen.h"
#include "src/__support/macros/config.h"
#include <cassert>
#include <llvm/ADT/STLExtras.h>
#include <llvm/ADT/StringSet.h>
@ -542,11 +543,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 LIBC_NAMESPACE {\n";
Stream << "namespace LIBC_NAMESPACE_DECL {\n";
Stream << "\n";
codegen::functions::Serialize(Stream, Descriptors);
Stream << "\n";
Stream << "} // namespace LIBC_NAMESPACE\n";
Stream << "} // namespace LIBC_NAMESPACE_DECL\n";
Stream << "\n";
Stream << "namespace llvm {\n";
Stream << "namespace automemcpy {\n";

View File

@ -8,6 +8,7 @@
#include "automemcpy/CodeGen.h"
#include "automemcpy/RandomFunctionGenerator.h"
#include "src/__support/macros/config.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <optional>
@ -63,7 +64,7 @@ using llvm::libc_benchmarks::MemcpyConfiguration;
using llvm::libc_benchmarks::MemmoveConfiguration;
using llvm::libc_benchmarks::MemsetConfiguration;
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
static void memcpy_0xE00E29EE73994E2B(char *__restrict dst, const char *__restrict src, size_t size) {
using namespace LIBC_NAMESPACE::x86;
@ -134,7 +135,7 @@ static void bzero_0x475977492C218AD4(char * dst, size_t size) {
return splat_set<Align<_32,Arg::Dst>::Then<Loop<_32>>>(dst, 0, size);
}
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
namespace llvm {
namespace automemcpy {

View File

@ -3,12 +3,13 @@
#include "src/__support/CPP/string_view.h"
#include "src/__support/OSUtil/io.h" // write_to_stderr
#include "src/__support/big_int.h" // is_big_int
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
#include "src/__support/uint128.h"
#include <stdint.h>
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace benchmarks {
// cpp::string_view specialization
@ -94,4 +95,4 @@ template BenchmarkLogger &BenchmarkLogger::operator<< <UInt<320>>(UInt<320>);
BenchmarkLogger log;
} // namespace benchmarks
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL

View File

@ -9,7 +9,9 @@
#ifndef LLVM_LIBC_BENCHMARKS_GPU_BENCHMARKLOGGER_H
#define LLVM_LIBC_BENCHMARKS_GPU_BENCHMARKLOGGER_H
namespace LIBC_NAMESPACE {
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
namespace benchmarks {
// A class to log to standard output in the context of hermetic tests.
@ -22,6 +24,6 @@ struct BenchmarkLogger {
extern BenchmarkLogger log;
} // namespace benchmarks
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif /* LLVM_LIBC_BENCHMARKS_GPU_BENCHMARKLOGGER_H */

View File

@ -5,9 +5,10 @@
#include "src/__support/FPUtil/sqrt.h"
#include "src/__support/GPU/utils.h"
#include "src/__support/fixedvector.h"
#include "src/__support/macros/config.h"
#include "src/time/gpu/time_utils.h"
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace benchmarks {
FixedVector<Benchmark *, 64> benchmarks;
@ -135,4 +136,4 @@ BenchmarkResult benchmark(const BenchmarkOptions &options,
};
} // namespace benchmarks
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL

View File

@ -6,11 +6,12 @@
#include "src/__support/CPP/functional.h"
#include "src/__support/CPP/limits.h"
#include "src/__support/CPP/string_view.h"
#include "src/__support/macros/config.h"
#include "src/time/clock.h"
#include <stdint.h>
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace benchmarks {
@ -99,7 +100,7 @@ private:
const cpp::string_view get_name() const { return name; }
};
} // namespace benchmarks
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#define BENCHMARK(SuiteName, TestName, Func) \
LIBC_NAMESPACE::benchmarks::Benchmark SuiteName##_##TestName##_Instance( \

View File

@ -25,7 +25,7 @@
else \
asm("" ::"v"(VARIABLE))
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
// Returns the overhead associated with calling the profiling region. This
// allows us to substract the constant-time overhead from the latency to
@ -107,6 +107,6 @@ template <typename F, typename T1, typename T2>
return stop - start;
}
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_UTILS_GPU_TIMING_AMDGPU

View File

@ -16,7 +16,7 @@
#include <stdint.h>
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
// Returns the overhead associated with calling the profiling region. This
// allows us to substract the constant-time overhead from the latency to
@ -94,6 +94,6 @@ static LIBC_INLINE uint64_t latency(F f, T1 t1, T2 t2) {
return stop - start;
}
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_UTILS_GPU_TIMING_NVPTX

View File

@ -93,11 +93,11 @@ function(create_object_library fq_target_name)
endif()
endif()
if(fq_deps_list)
add_dependencies(${fq_target_name} ${fq_deps_list})
# Add deps as link libraries to inherit interface compile and link options.
target_link_libraries(${fq_target_name} PUBLIC ${fq_deps_list})
endif()
list(APPEND fq_deps_list libc.src.__support.macros.config)
list(REMOVE_DUPLICATES fq_deps_list)
add_dependencies(${fq_target_name} ${fq_deps_list})
# Add deps as link libraries to inherit interface compile and link options.
target_link_libraries(${fq_target_name} PUBLIC ${fq_deps_list})
set_target_properties(
${fq_target_name}

View File

@ -9,11 +9,12 @@
#ifndef LLVM_LIBC_CONFIG_LINUX_APP_H
#define LLVM_LIBC_CONFIG_LINUX_APP_H
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h"
#include <stdint.h>
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
// Data structure to capture properties of the linux/ELF TLS image.
struct TLSImage {
@ -104,6 +105,6 @@ void cleanup_tls(uintptr_t tls_addr, uintptr_t tls_size);
// Set the thread pointer for the current thread.
bool set_thread_ptr(uintptr_t val);
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_CONFIG_LINUX_APP_H

View File

@ -36,17 +36,17 @@ implementation-in-namespace
---------------------------
It is part of our implementation standards that all implementation pieces live
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.
under the ``LIBC_NAMESPACE_DECL`` 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
``LIBC_NAMESPACE`` namespace.
``LIBC_NAMESPACE_DECL`` namespace.
.. code-block:: c++
// Correct: implementation inside the correct namespace.
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
void LLVM_LIBC_ENTRYPOINT(strcpy)(char *dest, const char *src) {}
// Namespaces within LIBC_NAMESPACE namespace are allowed.
namespace inner{
@ -87,7 +87,7 @@ are always external and can be intercepted.
.. code-block:: c++
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
// Allow calls with the fully qualified name.
LIBC_NAMESPACE::strlen("hello");
@ -104,4 +104,4 @@ are always external and can be intercepted.
// Allow calling into specific global functions (explained above)
::malloc(10);
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL

View File

@ -12,8 +12,9 @@
#include "include/llvm-libc-types/ENTRY.h"
#include "src/__support/CPP/string_view.h"
#include "src/__support/HashTable/table.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
// A fuzzing payload starts with
// - uint16_t: initial capacity for table A
@ -179,4 +180,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
return 0;
}
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL

View File

@ -13,8 +13,9 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_ALGORITHM_H
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
template <class T> LIBC_INLINE constexpr const T &max(const T &a, const T &b) {
@ -41,6 +42,6 @@ LIBC_INLINE constexpr bool all_of(InputIt first, InputIt last, UnaryPred p) {
}
} // namespace cpp
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ALGORITHM_H

View File

@ -11,9 +11,10 @@
#include "src/__support/CPP/iterator.h" // reverse_iterator
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
#include <stddef.h> // For size_t.
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
template <class T, size_t N> struct array {
@ -74,6 +75,6 @@ template <class T, size_t N> struct array {
};
} // namespace cpp
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ARRAY_H

View File

@ -10,11 +10,12 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_ATOMIC_H
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h"
#include "type_traits.h"
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
enum class MemoryOrder : int {
@ -211,6 +212,6 @@ LIBC_INLINE void atomic_signal_fence([[maybe_unused]] MemoryOrder mem_ord) {
}
} // namespace cpp
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ATOMIC_H

View File

@ -14,11 +14,13 @@
#include "src/__support/CPP/limits.h" // numeric_limits
#include "src/__support/CPP/type_traits.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/sanitizer.h"
#include <stdint.h>
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
#if __has_builtin(__builtin_memcpy_inline)
#define LLVM_LIBC_HAS_BUILTIN_MEMCPY_INLINE
@ -290,6 +292,7 @@ ADD_SPECIALIZATION(unsigned long long, __builtin_popcountll)
#endif // __builtin_popcountg
#undef ADD_SPECIALIZATION
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_BIT_H

View File

@ -10,9 +10,11 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_BITSET_H
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
#include <stddef.h> // For size_t.
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
template <size_t NumberOfBits> struct bitset {
static_assert(NumberOfBits != 0,
@ -86,6 +88,7 @@ private:
size_t Data[NUMBER_OF_UNITS] = {0};
};
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_BITSET_H

View File

@ -10,9 +10,11 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_CSTDDEF_H
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
#include "type_traits.h" // For enable_if_t, is_integral_v.
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
enum class byte : unsigned char {};
@ -66,6 +68,7 @@ to_integer(byte b) noexcept {
return static_cast<IntegerType>(b);
}
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_CSTDDEF_H

View File

@ -10,8 +10,10 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_EXPECTED_H
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// This is used to hold an unexpected value so that a different constructor is
// selected.
@ -52,6 +54,7 @@ public:
LIBC_INLINE constexpr const T *operator->() const { return &exp; }
};
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_EXPECTED_H

View File

@ -17,10 +17,11 @@
#include "src/__support/CPP/type_traits/remove_reference.h"
#include "src/__support/CPP/utility/forward.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
#include <stdint.h>
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
/// A function type adapted from LLVM's function_ref.
@ -65,6 +66,6 @@ public:
};
} // namespace cpp
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_FUNCTIONAL_H

View File

@ -13,8 +13,9 @@
#include "src/__support/CPP/type_traits/is_convertible.h"
#include "src/__support/CPP/type_traits/is_same.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
template <typename T> struct iterator_traits;
@ -93,6 +94,6 @@ public:
};
} // namespace cpp
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ITERATOR_H

View File

@ -13,9 +13,10 @@
#include "src/__support/CPP/type_traits/is_integral.h"
#include "src/__support/CPP/type_traits/is_signed.h"
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
namespace internal {
@ -86,6 +87,6 @@ struct numeric_limits<__uint128_t>
#endif
} // namespace cpp
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_LIMITS_H

View File

@ -9,7 +9,9 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_MUTEX_H
#define LLVM_LIBC_SRC___SUPPORT_CPP_MUTEX_H
namespace LIBC_NAMESPACE {
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// Assume the calling thread has already obtained mutex ownership.
@ -44,6 +46,6 @@ public:
template <typename T> lock_guard(T &) -> lock_guard<T>;
} // namespace cpp
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_MUTEX_H

View File

@ -10,6 +10,7 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_NEW_H
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include <stddef.h> // For size_t
#include <stdlib.h> // For malloc, free etc.
@ -23,7 +24,7 @@ enum class align_val_t : size_t {};
} // namespace std
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
class AllocChecker {
bool success = false;
@ -52,7 +53,7 @@ public:
}
};
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
LIBC_INLINE void *operator new(size_t size,
LIBC_NAMESPACE::AllocChecker &ac) noexcept {

View File

@ -12,8 +12,9 @@
#include "src/__support/CPP/type_traits.h"
#include "src/__support/CPP/utility.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// Trivial nullopt_t struct.
@ -133,6 +134,6 @@ public:
};
} // namespace cpp
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_OPTIONAL_H

View File

@ -11,11 +11,13 @@
#include <stddef.h> // For size_t
#include "array.h" // For array
#include "src/__support/macros/config.h"
#include "type_traits.h" // For remove_cv_t, enable_if_t, is_same_v, is_const_v
#include "src/__support/macros/attributes.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// A trimmed down implementation of std::span.
// Missing features:
@ -119,6 +121,7 @@ private:
size_t span_size;
};
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_SPAN_H

View File

@ -11,6 +11,7 @@
#include "src/__support/CPP/string_view.h"
#include "src/__support/integer_to_string.h" // IntegerToString
#include "src/__support/macros/config.h"
#include "src/string/memory_utils/inline_memcpy.h"
#include "src/string/memory_utils/inline_memset.h"
#include "src/string/string_utils.h" // string_length
@ -18,7 +19,7 @@
#include <stddef.h> // size_t
#include <stdlib.h> // malloc, free
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// This class mimics std::string but does not intend to be a full fledged
@ -225,6 +226,6 @@ LIBC_INLINE string to_string(unsigned long long value) {
// LIBC_INLINE string to_string(long double value);
} // namespace cpp
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_STRING_H

View File

@ -10,10 +10,11 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_STRING_VIEW_H
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include <stddef.h>
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// This is very simple alternate of the std::string_view class. There is no
@ -214,6 +215,6 @@ public:
};
} // namespace cpp
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_STRING_VIEW_H

View File

@ -10,12 +10,13 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_STRINGSTREAM_H
#include "span.h"
#include "src/__support/macros/config.h"
#include "string_view.h"
#include "type_traits.h"
#include "src/__support/integer_to_string.h"
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// This class is to be used to write simple strings into a user provided buffer
@ -90,6 +91,6 @@ public:
};
} // namespace cpp
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_STRINGSTREAM_H

View File

@ -9,8 +9,10 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_LVALUE_REFERENCE_H
#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// add_lvalue_reference
namespace detail {
@ -25,6 +27,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_LVALUE_REFERENCE_H

View File

@ -10,8 +10,10 @@
#include "src/__support/CPP/type_traits/remove_reference.h"
#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// add_pointer
namespace detail {
@ -22,6 +24,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_POINTER_H

View File

@ -9,8 +9,10 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_RVALUE_REFERENCE_H
#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// add_rvalue_reference
namespace detail {
@ -24,6 +26,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_RVALUE_REFERENCE_H

View File

@ -9,9 +9,11 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ALIGNED_STORAGE_H
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ALIGNED_STORAGE_H
#include "src/__support/macros/config.h"
#include <stddef.h> // size_t
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
template <size_t Len, size_t Align> struct aligned_storage {
struct type {
@ -22,6 +24,7 @@ template <size_t Len, size_t Align> struct aligned_storage {
template <size_t Len, size_t Align>
using aligned_storage_t = typename aligned_storage<Len, Align>::type;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ALIGNED_STORAGE_H

View File

@ -10,8 +10,10 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ALWAYS_FALSE_H
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// This is technically not part of the standard but it come often enough that
// it's convenient to have around.
@ -24,6 +26,7 @@ namespace LIBC_NAMESPACE::cpp {
// Usage `static_assert(cpp::always_false<T>, "error message");`
template <typename...> LIBC_INLINE_VAR constexpr bool always_false = false;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ALWAYS_FALSE_H

View File

@ -9,12 +9,15 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_BOOL_CONSTANT_H
#include "src/__support/CPP/type_traits/integral_constant.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// bool_constant
template <bool V> using bool_constant = cpp::integral_constant<bool, V>;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_BOOL_CONSTANT_H

View File

@ -9,8 +9,10 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_CONDITIONAL_H
#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// conditional
template <bool B, typename T, typename F>
@ -20,6 +22,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_CONDITIONAL_H

View File

@ -17,8 +17,10 @@
#include "src/__support/CPP/type_traits/remove_cv.h"
#include "src/__support/CPP/type_traits/remove_extent.h"
#include "src/__support/CPP/type_traits/remove_reference.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// decay
template <class T> class decay {
@ -32,6 +34,7 @@ public:
};
template <class T> using decay_t = typename decay<T>::type;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_DECAY_H

View File

@ -9,8 +9,10 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ENABLE_IF_H
#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// enable_if
template <bool B, typename T = void> struct enable_if;
@ -18,6 +20,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ENABLE_IF_H

View File

@ -9,12 +9,15 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_FALSE_TYPE_H
#include "src/__support/CPP/type_traits/bool_constant.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// false_type
using false_type = cpp::bool_constant<false>;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_FALSE_TYPE_H

View File

@ -9,8 +9,10 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INTEGRAL_CONSTANT_H
#include "src/__support/macros/attributes.h" // LIBC_INLINE_VAR
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// integral_constant
template <typename T, T v> struct integral_constant {
@ -18,6 +20,7 @@ template <typename T, T v> struct integral_constant {
LIBC_INLINE_VAR static constexpr T value = v;
};
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INTEGRAL_CONSTANT_H

View File

@ -17,8 +17,10 @@
#include "src/__support/CPP/type_traits/is_same.h"
#include "src/__support/CPP/utility/forward.h"
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
namespace detail {
@ -59,6 +61,7 @@ decltype(auto) invoke(Function &&fun, Args &&...args) {
cpp::forward<Function>(fun), cpp::forward<Args>(args)...);
}
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INVOKE_H

View File

@ -11,8 +11,10 @@
#include "src/__support/CPP/type_traits/invoke.h"
#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/CPP/utility/declval.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
template <class F, class... Args>
struct invoke_result : cpp::type_identity<decltype(cpp::invoke(
@ -21,6 +23,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INVOKE_RESULT_H

View File

@ -12,8 +12,10 @@
#include "src/__support/CPP/type_traits/is_floating_point.h"
#include "src/__support/CPP/type_traits/is_integral.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_arithmetic
template <typename T>
@ -22,6 +24,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ARITHMETIC_H

View File

@ -11,10 +11,12 @@
#include "src/__support/CPP/type_traits/false_type.h"
#include "src/__support/CPP/type_traits/true_type.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
#include <stddef.h> // For size_t
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_array
template <class T> struct is_array : false_type {};
@ -23,6 +25,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ARRAY_H

View File

@ -14,8 +14,10 @@
#include "src/__support/CPP/type_traits/remove_all_extents.h"
#include "src/__support/CPP/type_traits/true_type.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_base_of
namespace detail {
@ -39,6 +41,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_BASE_OF_H

View File

@ -12,8 +12,10 @@
#include "src/__support/CPP/type_traits/false_type.h"
#include "src/__support/CPP/type_traits/is_union.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_class
namespace detail {
@ -24,6 +26,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CLASS_H

View File

@ -11,8 +11,10 @@
#include "src/__support/CPP/type_traits/false_type.h"
#include "src/__support/CPP/type_traits/true_type.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_const
template <class T> struct is_const : cpp::false_type {};
@ -20,6 +22,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONST_H

View File

@ -9,13 +9,16 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONSTANT_EVALUATED_H
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
LIBC_INLINE constexpr bool is_constant_evaluated() {
return __builtin_is_constant_evaluated();
}
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONSTANT_EVALUATED_H

View File

@ -11,8 +11,10 @@
#include "src/__support/CPP/type_traits/is_void.h"
#include "src/__support/CPP/utility/declval.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_convertible
namespace detail {
@ -40,6 +42,7 @@ template <class From, class To>
LIBC_INLINE_VAR constexpr bool is_convertible_v =
is_convertible<From, To>::value;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONVERTIBLE_H

View File

@ -16,8 +16,10 @@
#include "src/__support/CPP/type_traits/true_type.h"
#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_destructible
#if __has_builtin(__is_destructible)
@ -60,6 +62,7 @@ template <> struct is_destructible<void> : public false_type {};
template <class T>
LIBC_INLINE_VAR constexpr bool is_destructible_v = is_destructible<T>::value;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_DESTRUCTIBLE_H

View File

@ -10,14 +10,17 @@
#include "src/__support/CPP/type_traits/bool_constant.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ENUM_H

View File

@ -13,8 +13,10 @@
#include "src/__support/macros/attributes.h"
#include "include/llvm-libc-macros/stdfix-macros.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_fixed_point
#ifdef LIBC_COMPILER_HAS_FIXED_POINT
@ -41,6 +43,7 @@ template <typename T> struct is_fixed_point : false_type {};
template <typename T>
LIBC_INLINE_VAR constexpr bool is_fixed_point_v = is_fixed_point<T>::value;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_FIXED_POINT_H

View File

@ -11,9 +11,11 @@
#include "src/__support/CPP/type_traits/is_same.h"
#include "src/__support/CPP/type_traits/remove_cv.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_FLOAT128
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_floating_point
template <typename T> struct is_floating_point {
@ -40,6 +42,7 @@ template <typename T>
LIBC_INLINE_VAR constexpr bool is_floating_point_v =
is_floating_point<T>::value;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_FLOATING_POINT_H

View File

@ -12,8 +12,10 @@
#include "src/__support/CPP/type_traits/is_const.h"
#include "src/__support/CPP/type_traits/is_reference.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_function
#if __has_builtin(__is_function)
@ -27,6 +29,7 @@ struct is_function
template <class T>
LIBC_INLINE_VAR constexpr bool is_function_v = is_function<T>::value;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_FUNCTION_H

View File

@ -11,9 +11,11 @@
#include "src/__support/CPP/type_traits/is_same.h"
#include "src/__support/CPP/type_traits/remove_cv.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_integral
template <typename T> struct is_integral {
@ -35,6 +37,7 @@ public:
template <typename T>
LIBC_INLINE_VAR constexpr bool is_integral_v = is_integral<T>::value;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_INTEGRAL_H

View File

@ -12,8 +12,10 @@
#include "src/__support/CPP/type_traits/false_type.h"
#include "src/__support/CPP/type_traits/true_type.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_lvalue_reference
#if __has_builtin(__is_lvalue_reference)
@ -27,6 +29,7 @@ template <class T>
LIBC_INLINE_VAR constexpr bool is_lvalue_reference_v =
is_lvalue_reference<T>::value;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_LVALUE_REFERENCE_H

View File

@ -12,8 +12,10 @@
#include "src/__support/CPP/type_traits/remove_cv.h"
#include "src/__support/CPP/type_traits/true_type.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_member_pointer
template <class T> struct is_member_pointer_helper : cpp::false_type {};
@ -25,6 +27,7 @@ template <class T>
LIBC_INLINE_VAR constexpr bool is_member_pointer_v =
is_member_pointer<T>::value;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_MEMBER_POINTER_H

View File

@ -11,8 +11,10 @@
#include "src/__support/CPP/type_traits/is_same.h"
#include "src/__support/CPP/type_traits/remove_cv.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_null_pointer
using nullptr_t = decltype(nullptr);
@ -21,6 +23,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_NULL_POINTER_H

View File

@ -14,8 +14,10 @@
#include "src/__support/CPP/type_traits/is_scalar.h"
#include "src/__support/CPP/type_traits/is_union.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_object
template <class T>
@ -25,6 +27,7 @@ struct is_object
template <class T>
LIBC_INLINE_VAR constexpr bool is_object_v = is_object<T>::value;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_OBJECT_H

View File

@ -11,8 +11,10 @@
#include "src/__support/CPP/type_traits/false_type.h"
#include "src/__support/CPP/type_traits/true_type.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_pointer
template <typename T> struct is_pointer : cpp::false_type {};
@ -23,6 +25,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_POINTER_H

View File

@ -12,8 +12,10 @@
#include "src/__support/CPP/type_traits/false_type.h"
#include "src/__support/CPP/type_traits/true_type.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_reference
#if __has_builtin(__is_reference)
@ -26,6 +28,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_REFERENCE_H

View File

@ -12,8 +12,10 @@
#include "src/__support/CPP/type_traits/false_type.h"
#include "src/__support/CPP/type_traits/true_type.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_rvalue_reference
#if __has_builtin(__is_rvalue_reference)
@ -27,6 +29,7 @@ template <class T>
LIBC_INLINE_VAR constexpr bool is_rvalue_reference_v =
is_rvalue_reference<T>::value;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_RVALUE_REFERENCE_H

View File

@ -11,8 +11,10 @@
#include "src/__support/CPP/type_traits/false_type.h"
#include "src/__support/CPP/type_traits/true_type.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_same
template <typename T, typename U> struct is_same : cpp::false_type {};
@ -20,6 +22,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SAME_H

View File

@ -15,8 +15,10 @@
#include "src/__support/CPP/type_traits/is_null_pointer.h"
#include "src/__support/CPP/type_traits/is_pointer.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_scalar
template <class T>
@ -27,6 +29,7 @@ struct is_scalar
template <class T>
LIBC_INLINE_VAR constexpr bool is_scalar_v = is_scalar<T>::value;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SCALAR_H

View File

@ -11,8 +11,10 @@
#include "src/__support/CPP/type_traits/bool_constant.h"
#include "src/__support/CPP/type_traits/is_arithmetic.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_signed
template <typename T>
@ -23,6 +25,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SIGNED_H

View File

@ -9,14 +9,17 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_CONSTRUCTIBLE_H
#include "src/__support/CPP/type_traits/integral_constant.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_trivially_constructible
template <class T, class... Args>
struct is_trivially_constructible
: integral_constant<bool, __is_trivially_constructible(T, Args...)> {};
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_CONSTRUCTIBLE_H

View File

@ -9,14 +9,17 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_COPYABLE_H
#include "src/__support/CPP/type_traits/integral_constant.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_trivially_copyable
template <class T>
struct is_trivially_copyable
: public integral_constant<bool, __is_trivially_copyable(T)> {};
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_COPYABLE_H

View File

@ -11,8 +11,10 @@
#include "src/__support/CPP/type_traits/bool_constant.h"
#include "src/__support/CPP/type_traits/is_destructible.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_trivially_destructible
#if __has_builtin(__is_trivially_destructible)
@ -29,6 +31,7 @@ template <typename T>
LIBC_INLINE_VAR constexpr bool is_trivially_destructible_v =
is_trivially_destructible<T>::value;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_DESTRUCTIBLE_H

View File

@ -10,14 +10,17 @@
#include "src/__support/CPP/type_traits/bool_constant.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_UNION_H

View File

@ -11,8 +11,10 @@
#include "src/__support/CPP/type_traits/bool_constant.h"
#include "src/__support/CPP/type_traits/is_arithmetic.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// is_unsigned
template <typename T>
@ -23,6 +25,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_UNSIGNED_H

View File

@ -11,14 +11,17 @@
#include "src/__support/CPP/type_traits/is_same.h"
#include "src/__support/CPP/type_traits/remove_cv.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_VOID_H

View File

@ -9,9 +9,11 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_SIGNED_H
#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// make_signed
template <typename T> struct make_signed;
@ -33,6 +35,7 @@ template <> struct make_signed<__uint128_t> : type_identity<__int128_t> {};
#endif
template <typename T> using make_signed_t = typename make_signed<T>::type;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_SIGNED_H

View File

@ -9,9 +9,11 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_UNSIGNED_H
#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// make_unsigned
@ -38,6 +40,7 @@ template <> struct make_unsigned<__uint128_t> : type_identity<__uint128_t> {};
#endif
template <typename T> using make_unsigned_t = typename make_unsigned<T>::type;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_UNSIGNED_H

View File

@ -9,10 +9,12 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_ALL_EXTENTS_H
#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/macros/config.h"
#include <stddef.h> // size_t
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// remove_all_extents
#if __has_builtin(__remove_all_extents)
@ -33,6 +35,7 @@ template <typename T>
using remove_all_extents_t = typename remove_all_extents<T>::type;
#endif
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_ALL_EXTENTS_H

View File

@ -9,8 +9,10 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_CV_H
#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// remove_cv
template <class T> struct remove_cv : cpp::type_identity<T> {};
@ -20,6 +22,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_CV_H

View File

@ -10,8 +10,10 @@
#include "src/__support/CPP/type_traits/remove_cv.h"
#include "src/__support/CPP/type_traits/remove_reference.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// remove_cvref
template <typename T> struct remove_cvref {
@ -19,6 +21,7 @@ template <typename T> struct remove_cvref {
};
template <typename T> using remove_cvref_t = typename remove_cvref<T>::type;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_CVREF_H

View File

@ -9,9 +9,11 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_EXTENT_H
#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/macros/config.h"
#include "stddef.h" // size_t
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// remove_extent
template <class T> struct remove_extent : cpp::type_identity<T> {};
@ -20,6 +22,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_EXTENT_H

View File

@ -9,8 +9,10 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_REFERENCE_H
#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// remove_reference
template <class T> struct remove_reference : cpp::type_identity<T> {};
@ -19,6 +21,7 @@ template <class T> struct remove_reference<T &&> : cpp::type_identity<T> {};
template <class T>
using remove_reference_t = typename remove_reference<T>::type;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_REFERENCE_H

View File

@ -9,12 +9,15 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TRUE_TYPE_H
#include "src/__support/CPP/type_traits/bool_constant.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// true_type
using true_type = cpp::bool_constant<true>;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TRUE_TYPE_H

View File

@ -8,13 +8,17 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TYPE_IDENTITY_H
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TYPE_IDENTITY_H
namespace LIBC_NAMESPACE::cpp {
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// type_identity
template <typename T> struct type_identity {
using type = T;
};
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TYPE_IDENTITY_H

View File

@ -9,8 +9,10 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_VOID_T_H
#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// void_t
@ -21,6 +23,7 @@ template <typename... Ts> struct make_void : cpp::type_identity<void> {};
template <typename... Ts>
using void_t = typename detail::make_void<Ts...>::type;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_VOID_T_H

View File

@ -10,8 +10,10 @@
#include "src/__support/CPP/type_traits/add_rvalue_reference.h"
#include "src/__support/CPP/type_traits/always_false.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// declval
template <typename T> cpp::add_rvalue_reference_t<T> declval() {
@ -19,6 +21,7 @@ template <typename T> cpp::add_rvalue_reference_t<T> declval() {
"declval not allowed in an evaluated context");
}
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_DECLVAL_H

View File

@ -11,8 +11,10 @@
#include "src/__support/CPP/type_traits/is_lvalue_reference.h"
#include "src/__support/CPP/type_traits/remove_reference.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// forward
template <typename T>
@ -27,6 +29,7 @@ LIBC_INLINE constexpr T &&forward(remove_reference_t<T> &&value) {
return static_cast<T &&>(value);
}
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_FORWARD_H

View File

@ -9,10 +9,12 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_IN_PLACE_H
#include "src/__support/macros/attributes.h" // LIBC_INLINE, LIBC_INLINE_VAR
#include "src/__support/macros/config.h"
#include <stddef.h> // size_t
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// in_place
struct in_place_t {
@ -31,6 +33,7 @@ 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 LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_IN_PLACE_H

View File

@ -9,8 +9,10 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_INTEGER_SEQUENCE_H
#include "src/__support/CPP/type_traits/is_integral.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// integer_sequence
template <typename T, T... Ints> struct integer_sequence {
@ -32,6 +34,7 @@ template <typename T, int N>
using make_integer_sequence =
typename detail::make_integer_sequence<T, N - 1>::type;
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_INTEGER_SEQUENCE_H

View File

@ -10,8 +10,10 @@
#include "src/__support/CPP/type_traits/remove_reference.h"
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE::cpp {
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// move
template <class T>
@ -19,6 +21,7 @@ LIBC_INLINE constexpr cpp::remove_reference_t<T> &&move(T &&t) {
return static_cast<typename cpp::remove_reference_t<T> &&>(t);
}
} // namespace LIBC_NAMESPACE::cpp
} // namespace cpp
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_MOVE_H

View File

@ -15,10 +15,11 @@
#include "FEnvImpl.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/__support/uint128.h"
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace fputil {
template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
@ -308,6 +309,6 @@ setpayload(T &res, T pl) {
}
} // namespace fputil
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_BASICOPERATIONS_H

View File

@ -15,8 +15,9 @@
#include "src/__support/CPP/type_traits.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace fputil {
static constexpr int QUOTIENT_LSB_BITS = 3;
@ -115,6 +116,6 @@ LIBC_INLINE T remquo(T x, T y, int &q) {
}
} // namespace fputil
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_DIVISIONANDREMAINDEROPERATIONS_H

View File

@ -13,6 +13,7 @@
#include "hdr/math_macros.h"
#include "hdr/types/fenv_t.h"
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h"
#include "src/errno/libc_errno.h"
@ -34,7 +35,8 @@
#include "riscv/FEnvImpl.h"
#else
namespace LIBC_NAMESPACE::fputil {
namespace LIBC_NAMESPACE_DECL {
namespace fputil {
// All dummy functions silently succeed.
@ -62,10 +64,12 @@ LIBC_INLINE int get_env(fenv_t *) { return 0; }
LIBC_INLINE int set_env(const fenv_t *) { return 0; }
} // namespace LIBC_NAMESPACE::fputil
} // namespace fputil
} // namespace LIBC_NAMESPACE_DECL
#endif
namespace LIBC_NAMESPACE::fputil {
namespace LIBC_NAMESPACE_DECL {
namespace fputil {
LIBC_INLINE int clear_except_if_required(int excepts) {
if (math_errhandling & MATH_ERREXCEPT)
@ -90,6 +94,7 @@ LIBC_INLINE void set_errno_if_required(int err) {
libc_errno = err;
}
} // namespace LIBC_NAMESPACE::fputil
} // namespace fputil
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_FENVIMPL_H

View File

@ -11,10 +11,11 @@
#include "src/__support/CPP/type_traits.h"
#include "src/__support/FPUtil/generic/FMA.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h"
#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace fputil {
template <typename OutType, typename InType>
@ -33,6 +34,6 @@ template <> LIBC_INLINE double fma(double x, double y, double z) {
#endif // LIBC_TARGET_CPU_HAS_FMA
} // namespace fputil
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_FMA_H

View File

@ -14,6 +14,7 @@
#include "src/__support/common.h"
#include "src/__support/libc_assert.h" // LIBC_ASSERT
#include "src/__support/macros/attributes.h" // LIBC_INLINE, LIBC_INLINE_VAR
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_FLOAT128
#include "src/__support/math_extras.h" // mask_trailing_ones
#include "src/__support/sign.h" // Sign
@ -21,7 +22,7 @@
#include <stdint.h>
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace fputil {
// The supported floating point types.
@ -824,6 +825,6 @@ struct FPBits final : public internal::FPRepImpl<get_fp_type<T>(), FPBits<T>> {
};
} // namespace fputil
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_FPBITS_H

View File

@ -16,9 +16,10 @@
#include "src/__support/CPP/bit.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/__support/uint128.h"
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace fputil {
namespace internal {
@ -263,6 +264,6 @@ LIBC_INLINE T hypot(T x, T y) {
}
} // namespace fputil
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_HYPOT_H

View File

@ -21,9 +21,10 @@
#include "src/__support/CPP/type_traits.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace fputil {
template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
@ -258,7 +259,7 @@ LIBC_INLINE constexpr T nextupdown(T x) {
}
} // namespace fputil
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#ifdef LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80
#include "x86_64/NextAfterLongDouble.h"

View File

@ -16,8 +16,9 @@
#include "hdr/math_macros.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace fputil {
template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
@ -400,6 +401,6 @@ LIBC_INLINE I round_to_signed_integer_using_current_rounding_mode(F x) {
}
} // namespace fputil
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_NEARESTINTEGEROPERATIONS_H

View File

@ -13,10 +13,11 @@
#include "src/__support/CPP/type_traits.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include <stdint.h>
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace fputil {
// A class which stores the normalized form of a floating point value.
@ -267,6 +268,6 @@ template <> LIBC_INLINE NormalFloat<long double>::operator long double() const {
#endif // LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80
} // namespace fputil
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_NORMALFLOAT_H

View File

@ -12,6 +12,7 @@
#include "multiply_add.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
// Evaluate polynomial using Horner's Scheme:
// With polyeval(x, a_0, a_1, ..., a_n) = a_n * x^n + ... + a_1 * x + a_0, we
@ -20,7 +21,7 @@
// Example: to evaluate x^3 + 2*x^2 + 3*x + 4, call
// polyeval( x, 4.0, 3.0, 2.0, 1.0 )
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace fputil {
template <typename T>
@ -48,6 +49,6 @@ polyeval(T x, T a0, Ts... a) {
}
} // namespace fputil
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_POLYEVAL_H

View File

@ -10,6 +10,7 @@
#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_AARCH64_FENVIMPL_H
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h"
#if !defined(LIBC_TARGET_ARCH_IS_AARCH64) || defined(__APPLE__)
@ -23,7 +24,7 @@
#include "hdr/types/fenv_t.h"
#include "src/__support/FPUtil/FPBits.h"
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace fputil {
struct FEnv {
@ -279,6 +280,6 @@ LIBC_INLINE int set_env(const fenv_t *envp) {
}
} // namespace fputil
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_AARCH64_FENVIMPL_H

View File

@ -10,6 +10,7 @@
#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_AARCH64_FENV_DARWIN_IMPL_H
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h"
#if !defined(LIBC_TARGET_ARCH_IS_AARCH64) || !defined(__APPLE__)
@ -23,7 +24,7 @@
#include "hdr/types/fenv_t.h"
#include "src/__support/FPUtil/FPBits.h"
namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace fputil {
struct FEnv {
@ -284,6 +285,6 @@ LIBC_INLINE int set_env(const fenv_t *envp) {
}
} // namespace fputil
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_AARCH64_FENV_DARWIN_IMPL_H

Some files were not shown because too many files have changed in this diff Show More