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 | 042f41b0476c02a76e268bf049ad29dd2543188f (patch) | |
tree | f9041367ab15a8a1e957f10ac2fe8709c53eb455 /llvm/lib/Support/ErrorHandling.cpp | |
parent | 054234faa8f026aac12b8a192d6464a485f3bc6a (diff) | |
download | bcm5719-llvm-042f41b0476c02a76e268bf049ad29dd2543188f.tar.gz bcm5719-llvm-042f41b0476c02a76e268bf049ad29dd2543188f.zip |
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.
llvm-svn: 200187
Diffstat (limited to 'llvm/lib/Support/ErrorHandling.cpp')
-rw-r--r-- | llvm/lib/Support/ErrorHandling.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/ErrorHandling.cpp b/llvm/lib/Support/ErrorHandling.cpp index 1aa8303b9e2..141319ca4ea 100644 --- a/llvm/lib/Support/ErrorHandling.cpp +++ b/llvm/lib/Support/ErrorHandling.cpp @@ -58,7 +58,7 @@ void llvm::report_fatal_error(const std::string &Reason, bool GenCrashDiag) { report_fatal_error(Twine(Reason), GenCrashDiag); } -void llvm::report_fatal_error(StringRef Reason, bool GenCrashDiag) { +void llvm::report_fatal_error(const StringRef &Reason, bool GenCrashDiag) { report_fatal_error(Twine(Reason), GenCrashDiag); } |