[libcxx-commits] [PATCH] D155185: [libc++] Work around dynamic linking of stringbuf::str() on Windows
Piotr Fusik via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 14 09:52:57 PDT 2023
pfusik updated this revision to Diff 540465.
pfusik retitled this revision from "[libc++] Work around #40363 for stringbuf::str()" to "[libc++] Work around dynamic linking of stringbuf::str() on Windows".
pfusik edited the summary of this revision.
pfusik added a comment.
Herald added a subscriber: bd1976llvm.
Update the commit message with `arc diff --edit`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155185/new/
https://reviews.llvm.org/D155185
Files:
libcxx/include/sstream
Index: libcxx/include/sstream
===================================================================
--- libcxx/include/sstream
+++ libcxx/include/sstream
@@ -247,6 +247,14 @@
#include <__undef_macros>
+// TODO(LLVM-19): Remove this once we drop support for Clang 16,
+// which had this bug: https://github.com/llvm/llvm-project/issues/40363
+#ifdef _WIN32
+#define _LIBCPP_HIDE_FROM_ABI_SSTREAM _LIBCPP_ALWAYS_INLINE
+#else
+#define _LIBCPP_HIDE_FROM_ABI_SSTREAM _LIBCPP_HIDE_FROM_ABI
+#endif
+
_LIBCPP_BEGIN_NAMESPACE_STD
// Class template basic_stringbuf [stringbuf]
@@ -352,15 +360,9 @@
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
string_type str() const;
#else
- _LIBCPP_HIDE_FROM_ABI string_type str() const & { return str(__str_.get_allocator()); }
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const & { return str(__str_.get_allocator()); }
- template <class _SAlloc>
- requires __is_allocator<_SAlloc>::value
- _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
- return basic_string<_CharT, _Traits, _SAlloc>(view(), __sa);
- }
-
- _LIBCPP_HIDE_FROM_ABI string_type str() && {
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && {
const basic_string_view<_CharT, _Traits> __view = view();
string_type __result(std::move(__str_), __view.data() - __str_.data(), __view.size());
__str_.clear();
@@ -370,6 +372,12 @@
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
#if _LIBCPP_STD_VER >= 20
+ template <class _SAlloc>
+ requires __is_allocator<_SAlloc>::value
+ _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
+ return basic_string<_CharT, _Traits, _SAlloc>(view(), __sa);
+ }
+
_LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept;
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155185.540465.patch
Type: text/x-patch
Size: 1936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230714/06f43cc4/attachment.bin>
More information about the libcxx-commits
mailing list