From e130dc6cc9ec1423086c37f557ef8854064fef4a Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Fri, 26 Jul 2013 21:50:30 +0000 Subject: 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 --- include/llvm/ADT/StringRef.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include/llvm/ADT') 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 struct isPodLike; template <> struct isPodLike { static const bool value = true; }; + /// Construct a string ref from a boolean. + inline StringRef toStringRef(bool B) { + return StringRef(B ? "true" : "false"); + } } #endif -- cgit v1.2.3