[libcxx-commits] [PATCH] D155180: [libc++] Use always_inline for std::stringbuf::str() on Windows to work around #40363
Hans Wennborg via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 13 04:37:23 PDT 2023
hans created this revision.
hans added reviewers: pfusik, ldionne.
Herald added a project: All.
hans requested review of this revision.
Herald added subscribers: libcxx-commits, bd1976llvm.
Herald added a project: libc++.
Herald added a reviewer: libc++.
As reported in https://github.com/llvm/llvm-project/issues/40363, the exclude_from_explicit_instantiation attribute doesn't currently really work with dllimport.
Because of that, the new stringbuf::str() overload added in D153709 <https://reviews.llvm.org/D153709> is dllimport on Windows but not actually defined in the cpp file, causing link errors.
As discussed on that code review, this patch works around the problem with the always_inline attribute until Clang can be fixed.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D155180
Files:
libcxx/include/sstream
Index: libcxx/include/sstream
===================================================================
--- libcxx/include/sstream
+++ libcxx/include/sstream
@@ -334,7 +334,15 @@
#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()); }
+
+#ifdef _WIN32
+ // TODO(LLVM 19): Remove this once we drop support for Clang versions which
+ // have this bug: https://github.com/llvm/llvm-project/issues/40363
+ _LIBCPP_ALWAYS_INLINE
+#else
+ _LIBCPP_HIDE_FROM_ABI
+#endif
+ string_type str() const & { return str(__str_.get_allocator()); }
template <class _SAlloc>
requires __is_allocator<_SAlloc>::value
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155180.539954.patch
Type: text/x-patch
Size: 757 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230713/0220b419/attachment.bin>
More information about the libcxx-commits
mailing list