Skip to content
Snippets Groups Projects
Commit 61b1a355 authored by Bill Wendling's avatar Bill Wendling
Browse files

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

llvm-svn: 187250
parent e37c2e4d
No related branches found
No related tags found
No related merge requests found
...@@ -90,10 +90,6 @@ namespace llvm { ...@@ -90,10 +90,6 @@ namespace llvm {
/*implicit*/ StringRef(const std::string &Str) /*implicit*/ StringRef(const std::string &Str)
: Data(Str.data()), Length(Str.length()) {} : 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 /// @name Iterators
/// @{ /// @{
...@@ -552,6 +548,10 @@ namespace llvm { ...@@ -552,6 +548,10 @@ namespace llvm {
template <typename T> struct isPodLike; template <typename T> struct isPodLike;
template <> struct isPodLike<StringRef> { static const bool value = true; }; 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 #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment