summaryrefslogtreecommitdiff
path: root/include/llvm/ADT
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-07-26 21:50:30 +0000
committerBill Wendling <isanbard@gmail.com>2013-07-26 21:50:30 +0000
commite130dc6cc9ec1423086c37f557ef8854064fef4a (patch)
treedbe689e1e8967c509ed373ffe3f6445d666a261a /include/llvm/ADT
parent0c326f07ca713fa00d0dcba8ec9b61e91298f690 (diff)
downloadllvm-e130dc6cc9ec1423086c37f557ef8854064fef4a.tar.gz
llvm-e130dc6cc9ec1423086c37f557ef8854064fef4a.tar.bz2
llvm-e130dc6cc9ec1423086c37f557ef8854064fef4a.tar.xz
Use a non-c'tor for converting a boolean into a StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187250 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r--include/llvm/ADT/StringRef.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h
index 56848fb616..6215d3f6ea 100644
--- a/include/llvm/ADT/StringRef.h
+++ b/include/llvm/ADT/StringRef.h
@@ -90,10 +90,6 @@ namespace llvm {
/*implicit*/ StringRef(const std::string &Str)
: Data(Str.data()), Length(Str.length()) {}
- /// Construct a string ref from a boolean.
- explicit StringRef(bool B)
- : Data(B ? "true" : "false"), Length(::strlen(Data)) {}
-
/// @}
/// @name Iterators
/// @{
@@ -552,6 +548,10 @@ namespace llvm {
template <typename T> struct isPodLike;
template <> struct isPodLike<StringRef> { static const bool value = true; };
+ /// Construct a string ref from a boolean.
+ inline StringRef toStringRef(bool B) {
+ return StringRef(B ? "true" : "false");
+ }
}
#endif