[libcxx-commits] [libcxx] [libc++][NFC] Use std::quoted in fs::path and remove the private __quoted (PR #181043)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Feb 12 01:54:49 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Nikolas Klauser (philnik777)
<details>
<summary>Changes</summary>
We've provided `std::filesystem` before C++17 in the past, but we don't anymore, so we can use `std::quoted`.
---
Full diff: https://github.com/llvm/llvm-project/pull/181043.diff
2 Files Affected:
- (modified) libcxx/include/__filesystem/path.h (+3-3)
- (modified) libcxx/include/iomanip (+2-16)
``````````diff
diff --git a/libcxx/include/__filesystem/path.h b/libcxx/include/__filesystem/path.h
index 4957761c0ef7e..6f72a5bc94d8b 100644
--- a/libcxx/include/__filesystem/path.h
+++ b/libcxx/include/__filesystem/path.h
@@ -882,7 +882,7 @@ class _LIBCPP_EXPORTED_FROM_ABI path {
__enable_if_t<is_same<_CharT, value_type>::value && is_same<_Traits, char_traits<value_type> >::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
- __os << std::__quoted(__p.native());
+ __os << std::quoted(__p.native());
return __os;
}
@@ -892,7 +892,7 @@ class _LIBCPP_EXPORTED_FROM_ABI path {
__enable_if_t<!is_same<_CharT, value_type>::value || !is_same<_Traits, char_traits<value_type> >::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
- __os << std::__quoted(__p.string<_CharT, _Traits>());
+ __os << std::quoted(__p.string<_CharT, _Traits>());
return __os;
}
@@ -900,7 +900,7 @@ class _LIBCPP_EXPORTED_FROM_ABI path {
_LIBCPP_HIDE_FROM_ABI friend basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, path& __p) {
basic_string<_CharT, _Traits> __tmp;
- __is >> std::__quoted(__tmp);
+ __is >> std::quoted(__tmp);
__p = __tmp;
return __is;
}
diff --git a/libcxx/include/iomanip b/libcxx/include/iomanip
index d65d66d716597..bfe9039e4b302 100644
--- a/libcxx/include/iomanip
+++ b/libcxx/include/iomanip
@@ -413,6 +413,8 @@ inline _LIBCPP_HIDE_FROM_ABI __iom_t10<_CharT> put_time(const tm* __tm, const _C
return __iom_t10<_CharT>(__tm, __fmt);
}
+# if _LIBCPP_STD_VER >= 14
+
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& __quoted_output(
basic_ostream<_CharT, _Traits>& __os,
@@ -502,22 +504,6 @@ struct _LIBCPP_HIDDEN __quoted_proxy {
}
};
-template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI __quoted_output_proxy<_CharT, _Traits>
-__quoted(const basic_string<_CharT, _Traits, _Allocator>& __s,
- _CharT __delim = _CharT('"'),
- _CharT __escape = _CharT('\\')) {
- return __quoted_output_proxy<_CharT, _Traits>(__s.data(), __s.data() + __s.size(), __delim, __escape);
-}
-
-template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI __quoted_proxy<_CharT, _Traits, _Allocator>
-__quoted(basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) {
- return __quoted_proxy<_CharT, _Traits, _Allocator>(__s, __delim, __escape);
-}
-
-# if _LIBCPP_STD_VER >= 14
-
template <class _CharT>
_LIBCPP_HIDE_FROM_ABI auto quoted(const _CharT* __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) {
const _CharT* __end = __s;
``````````
</details>
https://github.com/llvm/llvm-project/pull/181043
More information about the libcxx-commits
mailing list