[libc++] Avoid overload resolution in path comparison operators
Rework `std::filesystem::path::operator==` and friends to avoid overload
resolution and atomic constraint caching issues shown from
https://reviews.llvm.org/D113161.
Always call `__compare(string_view)` from the comparison operators which avoids
overload resolution.
Differential Revision: https://reviews.llvm.org/D114570
GitOrigin-RevId: 3e7452a812fa06c5eaae7d089891489222417e92
diff --git a/include/filesystem b/include/filesystem
index 6a42824..c688ab7 100644
--- a/include/filesystem
+++ b/include/filesystem
@@ -1492,22 +1492,22 @@
#endif // !_LIBCPP_HAS_NO_LOCALIZATION
friend _LIBCPP_INLINE_VISIBILITY bool operator==(const path& __lhs, const path& __rhs) noexcept {
- return __lhs.compare(__rhs) == 0;
+ return __lhs.__compare(__rhs.__pn_) == 0;
}
friend _LIBCPP_INLINE_VISIBILITY bool operator!=(const path& __lhs, const path& __rhs) noexcept {
- return __lhs.compare(__rhs) != 0;
+ return __lhs.__compare(__rhs.__pn_) != 0;
}
friend _LIBCPP_INLINE_VISIBILITY bool operator<(const path& __lhs, const path& __rhs) noexcept {
- return __lhs.compare(__rhs) < 0;
+ return __lhs.__compare(__rhs.__pn_) < 0;
}
friend _LIBCPP_INLINE_VISIBILITY bool operator<=(const path& __lhs, const path& __rhs) noexcept {
- return __lhs.compare(__rhs) <= 0;
+ return __lhs.__compare(__rhs.__pn_) <= 0;
}
friend _LIBCPP_INLINE_VISIBILITY bool operator>(const path& __lhs, const path& __rhs) noexcept {
- return __lhs.compare(__rhs) > 0;
+ return __lhs.__compare(__rhs.__pn_) > 0;
}
friend _LIBCPP_INLINE_VISIBILITY bool operator>=(const path& __lhs, const path& __rhs) noexcept {
- return __lhs.compare(__rhs) >= 0;
+ return __lhs.__compare(__rhs.__pn_) >= 0;
}
friend _LIBCPP_INLINE_VISIBILITY path operator/(const path& __lhs,