Use a non-c'tor for converting a boolean into a StringRef.

llvm-svn: 187250
This commit is contained in:
Bill Wendling 2013-07-26 21:50:30 +00:00
parent e37c2e4d11
commit 61b1a3553f
1 changed files with 4 additions and 4 deletions

View File

@ -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