llvm/libc/utils/CPP
Guillaume Chatelet fa404ae43a [libc] Enhance ArrayRef + unittests
This patch mostly adds unittests for `ArrayRef` and `MutableArrayRef`, additionnaly:
 - We mimic the behavior of `std::vector` and disallow CV qualified type (`ArrayRef<const X>` is not allowed).
   This is to make sure that the type traits are always valid (e.g. `value_type`, `pointer`, ...).
 - In the previous implementation `ArrayRef` would define `value_type` as `const T` but this is not correct, it should be `T` for both `MutableArrayRef` and `ArrayRef`.
 - We add the `equals` method to ease testing,
 - We define the constructor taking an `Array` outside of the base implementation to ensure we match `const Array<T>&` and not `Array<const T>&` in the case of `ArrayRef`.

Differential Revision: https://reviews.llvm.org/D100732
2021-04-21 13:25:24 +00:00
..
Array.h
ArrayRef.h [libc] Enhance ArrayRef + unittests 2021-04-21 13:25:24 +00:00
Bitset.h
CMakeLists.txt
Functional.h
README.md
StringView.h
TypeTraits.h

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

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

  1. Only two kind of headers can be included: Other headers from this directory, 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 higher level namespace should have a __ prefix to avoid symbol name pollution when the utilities are used in implementation of public functions.