tree: bf6a04a3d5c5877228357cccd8a4d6895a0e0377 [path history] [tgz]
  1. type_traits/
  2. utility/
  3. .clang-tidy
  4. algorithm.h
  5. array.h
  6. atomic.h
  7. bit.h
  8. bitset.h
  9. CMakeLists.txt
  10. cstddef.h
  11. expected.h
  12. functional.h
  13. iterator.h
  14. limits.h
  15. mutex.h
  16. new.cpp
  17. new.h
  18. optional.h
  19. README.md
  20. simd.h
  21. span.h
  22. string.h
  23. string_view.h
  24. stringstream.h
  25. tuple.h
  26. type_traits.h
  27. utility.h
libc/src/__support/CPP/README.md

This directory contains partial re-implementations of some C++ standard library utilities. They are for use with internal LLVM libc code and tests.

More utilities can be added on an as-needed basis. There are certain rules to be followed for future changes and additions:

  • Only certain kind of headers can be included:

    • Other headers from this directory
    • Free-standing C headers (<stdint.h> et al)
    • A few basic src/__support/macros headers used pervasively in all libc code
  • 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>. The proxies can also be used, as in #include "hdr/stdint_proxy.h".

  • 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.

  • Each “CPP/foo.h” provides an exact subset of the API from standard C++ , just using LIBC_NAMESPACE::cpp::foo names in place of std::foo names. The implementations here need not be perfect standard-conforming implementations, but their behavior must match for whatever is supported at compile time. That is, if each were just declared with using std::foo; all the libc code should work the same (functionally speaking, excluding namespace entanglements).

  • Additional APIs specific to libc internals belong elsewhere in src/__support, not in src/__support/CPP.