[libcxx-commits] [PATCH] D114570: [libc++] Avoid overload resolution in path comparison operators
Joe Loser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Nov 24 19:54:06 PST 2021
jloser created this revision.
jloser added reviewers: Quuxplusone, ldionne, Mordante.
jloser requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D114570
Files:
libcxx/include/filesystem
Index: libcxx/include/filesystem
===================================================================
--- libcxx/include/filesystem
+++ libcxx/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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114570.389647.patch
Type: text/x-patch
Size: 1445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211125/76831be9/attachment.bin>
More information about the libcxx-commits
mailing list