[libcxx-commits] [libcxx] dd37e24 - [libc++] Hide some functions and types in <future> and <thread> as hidden

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 10 16:19:58 PST 2019


Author: Louis Dionne
Date: 2019-12-10T19:19:45-05:00
New Revision: dd37e24ae62329d8376b7989dc2e3a53be30622a

URL: https://github.com/llvm/llvm-project/commit/dd37e24ae62329d8376b7989dc2e3a53be30622a
DIFF: https://github.com/llvm/llvm-project/commit/dd37e24ae62329d8376b7989dc2e3a53be30622a.diff

LOG: [libc++] Hide some functions and types in <future> and <thread> as hidden

Otherwise, weak symbols leak into user programs when using `async` with
non-internal types.

Added: 
    

Modified: 
    libcxx/include/future
    libcxx/include/thread

Removed: 
    


################################################################################
diff  --git a/libcxx/include/future b/libcxx/include/future
index 6da88c6e62b2..deb7725f73de 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -611,7 +611,7 @@ __assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) c
 }
 
 template <class _Rp>
-class _LIBCPP_AVAILABILITY_FUTURE __assoc_state
+class _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_HIDDEN __assoc_state
     : public __assoc_sub_state
 {
     typedef __assoc_sub_state base;
@@ -1060,7 +1060,7 @@ template <class _Rp> class _LIBCPP_TEMPLATE_VIS shared_future;
 template <class _Rp> class _LIBCPP_TEMPLATE_VIS future;
 
 template <class _Rp, class _Fp>
-future<_Rp>
+_LIBCPP_INLINE_VISIBILITY future<_Rp>
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 __make_deferred_assoc_state(_Fp&& __f);
 #else
@@ -1068,7 +1068,7 @@ __make_deferred_assoc_state(_Fp __f);
 #endif
 
 template <class _Rp, class _Fp>
-future<_Rp>
+_LIBCPP_INLINE_VISIBILITY future<_Rp>
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 __make_async_assoc_state(_Fp&& __f);
 #else
@@ -2266,7 +2266,7 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<packaged_task<_Callable>, _Alloc>
     : public true_type {};
 
 template <class _Rp, class _Fp>
-future<_Rp>
+_LIBCPP_INLINE_VISIBILITY future<_Rp>
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 __make_deferred_assoc_state(_Fp&& __f)
 #else
@@ -2279,7 +2279,7 @@ __make_deferred_assoc_state(_Fp __f)
 }
 
 template <class _Rp, class _Fp>
-future<_Rp>
+_LIBCPP_INLINE_VISIBILITY future<_Rp>
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 __make_async_assoc_state(_Fp&& __f)
 #else
@@ -2293,7 +2293,7 @@ __make_async_assoc_state(_Fp __f)
 }
 
 template <class _Fp, class... _Args>
-class __async_func
+class _LIBCPP_HIDDEN __async_func
 {
     tuple<_Fp, _Args...> __f_;
 

diff  --git a/libcxx/include/thread b/libcxx/include/thread
index 02da703c3ccf..3b55342288d1 100644
--- a/libcxx/include/thread
+++ b/libcxx/include/thread
@@ -274,6 +274,7 @@ __thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __tuple_indices<_Indices...>)
 }
 
 template <class _Fp>
+_LIBCPP_INLINE_VISIBILITY
 void* __thread_proxy(void* __vp)
 {
     // _Fp = std::tuple< unique_ptr<__thread_struct>, Functor, Args...>


        


More information about the libcxx-commits mailing list