aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-08-23 17:44:13 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-08-23 17:44:13 +0000
commit5b50cc9622565356d42a96bb7083894122785d6f (patch)
tree3b5a872c5b115ea21bc6cbb7c1b37f432a32e10b
parent55bcf9a175c8c712aa4ce679fd87e5b68f320de9 (diff)
downloadexternal_llvm-5b50cc9622565356d42a96bb7083894122785d6f.zip
external_llvm-5b50cc9622565356d42a96bb7083894122785d6f.tar.gz
external_llvm-5b50cc9622565356d42a96bb7083894122785d6f.tar.bz2
StringRef tweaks:
- 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
-rw-r--r--include/llvm/ADT/StringRef.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h
index 9962bb2..a1be1e7 100644
--- a/include/llvm/ADT/StringRef.h
+++ b/include/llvm/ADT/StringRef.h
@@ -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.