[llvm] r200188 - Move true/false StringRef helper to StringExtras

Alp Toker alp at nuanti.com
Sun Jan 26 20:07:36 PST 2014


Author: alp
Date: Sun Jan 26 22:07:36 2014
New Revision: 200188

URL: http://llvm.org/viewvc/llvm-project?rev=200188&view=rev
Log:
Move true/false StringRef helper to StringExtras

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.

Modified:
    llvm/trunk/include/llvm/ADT/StringExtras.h
    llvm/trunk/include/llvm/ADT/StringRef.h

Modified: llvm/trunk/include/llvm/ADT/StringExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringExtras.h?rev=200188&r1=200187&r2=200188&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringExtras.h (original)
+++ llvm/trunk/include/llvm/ADT/StringExtras.h Sun Jan 26 22:07:36 2014
@@ -28,6 +28,11 @@ static inline char hexdigit(unsigned X,
   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.
 ///

Modified: llvm/trunk/include/llvm/ADT/StringRef.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=200188&r1=200187&r2=200188&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringRef.h (original)
+++ llvm/trunk/include/llvm/ADT/StringRef.h Sun Jan 26 22:07:36 2014
@@ -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





More information about the llvm-commits mailing list