[llvm] r187250 - Use a non-c'tor for converting a boolean into a StringRef.
Bill Wendling
isanbard at gmail.com
Fri Jul 26 14:50:31 PDT 2013
Author: void
Date: Fri Jul 26 16:50:30 2013
New Revision: 187250
URL: http://llvm.org/viewvc/llvm-project?rev=187250&view=rev
Log:
Use a non-c'tor for converting a boolean into a StringRef.
Modified:
llvm/trunk/include/llvm/ADT/StringRef.h
Modified: llvm/trunk/include/llvm/ADT/StringRef.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=187250&r1=187249&r2=187250&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringRef.h (original)
+++ llvm/trunk/include/llvm/ADT/StringRef.h Fri Jul 26 16:50:30 2013
@@ -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
More information about the llvm-commits
mailing list