forked from OSchip/llvm-project
07eb82fc06
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 |
||
---|---|---|
.. | ||
benchmarks | ||
cmake | ||
docs | ||
fuzzing | ||
include | ||
lib | ||
src | ||
test | ||
utils | ||
www | ||
.clang-format | ||
.gitignore | ||
CMakeLists.txt | ||
CREDITS.TXT | ||
LICENSE.TXT | ||
NOTES.TXT | ||
TODO.TXT | ||
appveyor-reqs-install.cmd | ||
appveyor.yml |