forked from OSchip/llvm-project
StringRef tweaks:
- Respect find_first_of(char's From parameter instead of silently dropping it. - Prefer std::string() to std::string("") llvm-svn: 111814
This commit is contained in:
parent
a42202e0e4
commit
0bf9c59d2f
|
@ -150,7 +150,7 @@ namespace llvm {
|
||||||
|
|
||||||
/// str - Get the contents as an std::string.
|
/// str - Get the contents as an std::string.
|
||||||
std::string str() const {
|
std::string str() const {
|
||||||
if (Data == 0) return "";
|
if (Data == 0) return std::string();
|
||||||
return std::string(Data, Length);
|
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,
|
/// find_first_of - Find the first character in the string that is \arg C,
|
||||||
/// or npos if not found. Same as find.
|
/// 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
|
/// find_first_of - Find the first character in the string that is in \arg
|
||||||
/// Chars, or npos if not found.
|
/// Chars, or npos if not found.
|
||||||
|
|
Loading…
Reference in New Issue