diff options
author | Alp Toker <alp@nuanti.com> | 2014-01-27 04:07:17 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2014-01-27 04:07:17 +0000 |
commit | bad91954cf7c2caae19728bed33729a390d88725 (patch) | |
tree | 25de33597852132787915526cf83f9a8524ae09b /tools/llvm-readobj | |
parent | 1943ce9b6e16d58ec7341f4c1b4fdca2e4f327e9 (diff) | |
download | llvm-bad91954cf7c2caae19728bed33729a390d88725.tar.gz llvm-bad91954cf7c2caae19728bed33729a390d88725.tar.bz2 llvm-bad91954cf7c2caae19728bed33729a390d88725.tar.xz |
StringRef: Extend constexpr capabilities and introduce ConstStringRef
(1) Add llvm_expect(), an asserting macro that can be evaluated as a constexpr
expression as well as a runtime assert or compiler hint in release builds. This
technique can be used to construct functions that are both unevaluated and
compiled depending on usage.
(2) Update StringRef using llvm_expect() to preserve runtime assertions while
extending the same checks to static asserts in C++11 builds that support the
feature.
(3) Introduce ConstStringRef, a strong subclass of StringRef that references
compile-time constant strings. It's convertible to, but not from, ordinary
StringRef and thus can be used to add compile-time safety to various interfaces
in LLVM and clang that only accept fixed inputs such as diagnostic format
strings that tend to get misused.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200187 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-readobj')
0 files changed, 0 insertions, 0 deletions