StringRef tweaks:
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 23 Aug 2010 17:44:13 +0000 (17:44 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 23 Aug 2010 17:44:13 +0000 (17:44 +0000)
- Respect find_first_of(char's From parameter instead of silently dropping it.
- Prefer std::string() to std::string("")

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

include/llvm/ADT/StringRef.h

index 9962bb2b18888e274f5405f62ac2fa7b4728579c..a1be1e70c2acd569e6bf593fde8cb07e46688d42 100644 (file)
@@ -150,7 +150,7 @@ namespace llvm {
 
     /// str - Get the contents as an std::string.
     std::string str() const {
-      if (Data == 0) return "";
+      if (Data == 0) return std::string();
       return std::string(Data, Length);
     }
 
@@ -231,7 +231,9 @@ namespace llvm {
 
     /// find_first_of - Find the first character in the string that is \arg C,
     /// or npos if not found. Same as find.
-    size_type find_first_of(char C, size_t = 0) const { return find(C); }
+    size_type find_first_of(char C, size_t From = 0) const {
+      return find(C, From);
+    }
 
     /// find_first_of - Find the first character in the string that is in \arg
     /// Chars, or npos if not found.