[PATCH] D34332: path: Use string_view_t consistently

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 18 12:13:10 PDT 2017


dexonsmith created this revision.

Most of filesystem/path.cpp uses `string_view_t`.  This fixes the two spots that use `string_view` directly.


https://reviews.llvm.org/D34332

Files:
  libcxx/src/experimental/filesystem/path.cpp


Index: libcxx/src/experimental/filesystem/path.cpp
===================================================================
--- libcxx/src/experimental/filesystem/path.cpp
+++ libcxx/src/experimental/filesystem/path.cpp
@@ -261,7 +261,8 @@
 string_view_pair separate_filename(string_view_t const & s) {
     if (s == "." || s == ".." || s.empty()) return string_view_pair{s, ""};
     auto pos = s.find_last_of('.');
-    if (pos == string_view_t::npos) return string_view_pair{s, string_view{}};
+    if (pos == string_view_t::npos)
+        return string_view_pair{s, string_view_t{}};
     return string_view_pair{s.substr(0, pos), s.substr(pos)};
 }
 
@@ -396,7 +397,7 @@
 size_t hash_value(const path& __p) noexcept {
   auto PP = PathParser::CreateBegin(__p.native());
   size_t hash_value = 0;
-  std::hash<string_view> hasher;
+  std::hash<string_view_t> hasher;
   while (PP) {
     hash_value = __hash_combine(hash_value, hasher(*PP));
     ++PP;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34332.102975.patch
Type: text/x-patch
Size: 952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170618/5d312a7c/attachment.bin>


More information about the cfe-commits mailing list