Move true/false StringRef helper to StringExtras
authorAlp Toker <alp@nuanti.com>
Mon, 27 Jan 2014 04:07:36 +0000 (04:07 +0000)
committerAlp Toker <alp@nuanti.com>
Mon, 27 Jan 2014 04:07:36 +0000 (04:07 +0000)
StringRef is a low-level data wrapper that shouldn't know about language
strings like 'true' and 'false' whereas StringExtras is just the place for
higher-level utilities.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200188 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/StringExtras.h
include/llvm/ADT/StringRef.h

index dccf3e809d4f8553c6a59a464d0a04152b3732d5..a0b3fe7a06cd149356325a9fd8993ae06efdbd60 100644 (file)
@@ -28,6 +28,11 @@ static inline char hexdigit(unsigned X, bool LowerCase = false) {
   return X < 10 ? '0' + X : HexChar + X - 10;
 }
 
+/// Construct a string ref from a boolean.
+static inline StringRef toStringRef(bool B) {
+  return StringRef(B ? "true" : "false");
+}
+
 /// Interpret the given character \p C as a hexadecimal digit and return its
 /// value.
 ///
index a35dfbfebac9b49fc63ca0a492cd345de2802a31..4491dc3ae16d46143b54420ad15aeee57e558639 100644 (file)
@@ -561,11 +561,6 @@ namespace llvm {
   // StringRefs can be treated like a POD type.
   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