diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 |
commit | cfca06d7963fa0909f90483b42a6d7d194d01e08 (patch) | |
tree | 209fb2a2d68f8f277793fc8df46c753d31bc853b /llvm/lib/Support/StringRef.cpp | |
parent | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (diff) |
Notes
Diffstat (limited to 'llvm/lib/Support/StringRef.cpp')
-rw-r--r-- | llvm/lib/Support/StringRef.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/llvm/lib/Support/StringRef.cpp b/llvm/lib/Support/StringRef.cpp index 104482de4ad7..ab67ef9ce85c 100644 --- a/llvm/lib/Support/StringRef.cpp +++ b/llvm/lib/Support/StringRef.cpp @@ -19,7 +19,7 @@ using namespace llvm; // MSVC emits references to this into the translation units which reference it. #ifndef _MSC_VER -const size_t StringRef::npos; +constexpr size_t StringRef::npos; #endif // strncasecmp() is not available on non-POSIX systems, so define an @@ -106,19 +106,13 @@ unsigned StringRef::edit_distance(llvm::StringRef Other, //===----------------------------------------------------------------------===// std::string StringRef::lower() const { - std::string Result(size(), char()); - for (size_type i = 0, e = size(); i != e; ++i) { - Result[i] = toLower(Data[i]); - } - return Result; + return std::string(map_iterator(begin(), toLower), + map_iterator(end(), toLower)); } std::string StringRef::upper() const { - std::string Result(size(), char()); - for (size_type i = 0, e = size(); i != e; ++i) { - Result[i] = toUpper(Data[i]); - } - return Result; + return std::string(map_iterator(begin(), toUpper), + map_iterator(end(), toUpper)); } //===----------------------------------------------------------------------===// |