summaryrefslogtreecommitdiff
path: root/libcxx/src/memory.cpp
diff options
context:
space:
mode:
authorLouis Dionne <ldionne.2@gmail.com>2022-04-11 12:32:40 -0400
committerLouis Dionne <ldionne.2@gmail.com>2022-04-12 13:44:30 -0400
commit0cc34ca7ecfc9d0efee322f60ed6c3169f4f70ca (patch)
tree1bf5caa1a0a785913f0eaf737310e5e78415f6e7 /libcxx/src/memory.cpp
parentcfa4fe7c51870fe6b480d541938f556cf0736fa2 (diff)
[libc++] Define legacy symbols for inline functions at a finer-grained level
When we build the library with the stable ABI, we need to include some functions in the dylib that were made inline in later versions of the library (to avoid breaking code that might be relying on those symbols). However, those methods were made non-inline whenever we'd be building the library, which means that all translation units would end up using the old out-of-line definition of these methods, as opposed to the new inlined version. This patch makes it so that only the translation units that actually define the out-of-line methods use the old definition, opening up potential optimization opportunities in other translation units. This should solve some of the issues encountered in D65667. Differential Revision: https://reviews.llvm.org/D123519
Diffstat (limited to 'libcxx/src/memory.cpp')
-rw-r--r--libcxx/src/memory.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/libcxx/src/memory.cpp b/libcxx/src/memory.cpp
index 1b8c6b7e80fc..5ee9cbff93e5 100644
--- a/libcxx/src/memory.cpp
+++ b/libcxx/src/memory.cpp
@@ -6,6 +6,11 @@
//
//===----------------------------------------------------------------------===//
+#include <__config>
+#ifdef _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
+# define _LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS
+#endif
+
#include <memory>
#ifndef _LIBCPP_HAS_NO_THREADS
@@ -38,7 +43,7 @@ __shared_weak_count::~__shared_weak_count()
{
}
-#if defined(_LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS)
+#if defined(_LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS)
void
__shared_count::__add_shared() noexcept
{
@@ -75,7 +80,7 @@ __shared_weak_count::__release_shared() noexcept
__release_weak();
}
-#endif // _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
+#endif // _LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS
void
__shared_weak_count::__release_weak() noexcept