[llvm-commits] [llvm] r111814 - /llvm/trunk/include/llvm/ADT/StringRef.h
Benjamin Kramer
benny.kra at googlemail.com
Mon Aug 23 10:44:13 PDT 2010
Author: d0k
Date: Mon Aug 23 12:44:13 2010
New Revision: 111814
URL: http://llvm.org/viewvc/llvm-project?rev=111814&view=rev
Log:
StringRef tweaks:
- Respect find_first_of(char's From parameter instead of silently dropping it.
- Prefer std::string() to std::string("")
Modified:
llvm/trunk/include/llvm/ADT/StringRef.h
Modified: llvm/trunk/include/llvm/ADT/StringRef.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=111814&r1=111813&r2=111814&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringRef.h (original)
+++ llvm/trunk/include/llvm/ADT/StringRef.h Mon Aug 23 12:44:13 2010
@@ -150,7 +150,7 @@
/// 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 @@
/// 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.
More information about the llvm-commits
mailing list