llvm.org GIT mirror llvm / 810a9cf
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200188 91177308-0d34-0410-b5e6-96231b3b80d8 Alp Toker 6 years ago
2 changed file(s) with 5 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
2525 static inline char hexdigit(unsigned X, bool LowerCase = false) {
2626 const char HexChar = LowerCase ? 'a' : 'A';
2727 return X < 10 ? '0' + X : HexChar + X - 10;
28 }
29
30 /// Construct a string ref from a boolean.
31 static inline StringRef toStringRef(bool B) {
32 return StringRef(B ? "true" : "false");
2833 }
2934
3035 /// Interpret the given character \p C as a hexadecimal digit and return its
560560 // StringRefs can be treated like a POD type.
561561 template struct isPodLike;
562562 template <> struct isPodLike { static const bool value = true; };
563
564 /// Construct a string ref from a boolean.
565 inline StringRef toStringRef(bool B) {
566 return StringRef(B ? "true" : "false");
567 }
568563 }
569564
570565 #endif