llvm-project/libcxx
Martijn Vels 07eb82fc06 Add _LIBCPP_BUILTIN_CONSTANT_P support.
Summary:
This change adds the macros _LIBCPP_COMPILER_HAS_BUILTIN_CONSTANT and _LIBCPP_BUILTIN_CONSTANT_P to detect compile time constants, and optimze the code accordingly.

A planned usage example:
The implementation of basic_string::assign() can short-cut a compile time known short string assignent into a fast and compact inlined assignment:

```
basic_string::assign(const value_type* __s) {
  if (_LIBCPP_BUILTIN_CONSTANT_P(__s[0]) && length(__s) < __min_cap) {
    copy(pointer(), _s, length(__s) + 1);
    set_size(length(__s));
  } else {
    // delegate / tail call out of line implementation
  }
}
```

Subscribers: christof, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D73732
2020-02-26 11:03:51 -05:00
..
benchmarks Add benchmarks for basic_string::erase 2020-02-19 17:09:25 -05:00
cmake [libc++] Explicitly specify LIBCXX_ENABLE_SHARED to try and fix CI 2020-01-29 17:29:43 -08:00
docs Reland [libc++] [P0325] Implement to_array from LFTS with updates. 2020-01-31 11:47:18 +01:00
fuzzing [libc++] Tolerate NaN returning random distributions for now 2019-12-12 17:11:13 -05:00
include Add _LIBCPP_BUILTIN_CONSTANT_P support. 2020-02-26 11:03:51 -05:00
lib [libc++] Fix CI and Linux failures after landing D68480 2020-02-24 11:58:25 -05:00
src [libc++] Drop redundant check for -std=c++14 2020-02-24 12:23:05 -05:00
test [NFC][libc++] Refactor some future tests to reduce code duplication 2020-02-25 18:16:45 -05:00
utils [libc++] Do not set the `availability=XXX` feature when not testing against a system libc++ 2020-02-21 14:21:16 -05:00
www [libc++] Implementation of C++20's P1135R6 for libcxx 2020-02-24 10:59:35 -05:00
.clang-format
.gitignore
CMakeLists.txt [CMake][libcxx] Don't wrap __config_site path in quotes on Windows 2020-01-29 19:37:35 -08:00
CREDITS.TXT [libcxx] Add Sergej Jaskiewicz to CREDITS.txt 2019-11-21 12:06:10 +03:00
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
NOTES.TXT Reland "Use custom command and target to install libc++ headers" 2018-06-12 03:10:02 +00:00
TODO.TXT
appveyor-reqs-install.cmd Attempt to upgrade compiler used by appveyor builds 2019-04-03 20:40:01 +00:00
appveyor.yml disable appveyor config for MSVC 2015 2019-04-03 20:36:51 +00:00