diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-08-23 17:44:13 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-08-23 17:44:13 +0000 |
commit | 0bf9c59d2f20510c7bca2b50bca2f17e2a65f460 (patch) | |
tree | e3f99b37b170d7c98cb4bfb24577d39d7077a6d1 /llvm | |
parent | a42202e0e49869e6a0ddb1a11b799378bf59e9a8 (diff) | |
download | bcm5719-llvm-0bf9c59d2f20510c7bca2b50bca2f17e2a65f460.tar.gz bcm5719-llvm-0bf9c59d2f20510c7bca2b50bca2f17e2a65f460.zip |
StringRef tweaks:
- Respect find_first_of(char's From parameter instead of silently dropping it.
- Prefer std::string() to std::string("")
llvm-svn: 111814
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/ADT/StringRef.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h index 9962bb2b188..a1be1e70c2a 100644 --- a/llvm/include/llvm/ADT/StringRef.h +++ b/llvm/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. |