Skip to content

Commit 6cc8d54

Browse files
authored
[libc++] Add missing hide-from-ABI annotations on virtual functions (#85439)
1 parent c0d03d2 commit 6cc8d54

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

libcxx/include/__functional/function.h

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ class __func<_Rp1 (^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)> : public __base
768768
{
769769
}
770770

771-
virtual __base<_Rp(_ArgTypes...)>* __clone() const {
771+
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual __base<_Rp(_ArgTypes...)>* __clone() const {
772772
_LIBCPP_ASSERT_INTERNAL(
773773
false,
774774
"Block pointers are just pointers, so they should always fit into "
@@ -777,34 +777,40 @@ class __func<_Rp1 (^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)> : public __base
777777
return nullptr;
778778
}
779779

780-
virtual void __clone(__base<_Rp(_ArgTypes...)>* __p) const { ::new ((void*)__p) __func(__f_); }
780+
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __clone(__base<_Rp(_ArgTypes...)>* __p) const {
781+
::new ((void*)__p) __func(__f_);
782+
}
781783

782-
virtual void destroy() _NOEXCEPT {
784+
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy() _NOEXCEPT {
783785
# ifndef _LIBCPP_HAS_OBJC_ARC
784786
if (__f_)
785787
_Block_release(__f_);
786788
# endif
787789
__f_ = 0;
788790
}
789791

790-
virtual void destroy_deallocate() _NOEXCEPT {
792+
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy_deallocate() _NOEXCEPT {
791793
_LIBCPP_ASSERT_INTERNAL(
792794
false,
793795
"Block pointers are just pointers, so they should always fit into "
794796
"std::function's small buffer optimization. This function should "
795797
"never be invoked.");
796798
}
797799

798-
virtual _Rp operator()(_ArgTypes&&... __arg) { return std::__invoke(__f_, std::forward<_ArgTypes>(__arg)...); }
800+
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual _Rp operator()(_ArgTypes&&... __arg) {
801+
return std::__invoke(__f_, std::forward<_ArgTypes>(__arg)...);
802+
}
799803

800804
# ifndef _LIBCPP_HAS_NO_RTTI
801-
virtual const void* target(type_info const& __ti) const _NOEXCEPT {
805+
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const void* target(type_info const& __ti) const _NOEXCEPT {
802806
if (__ti == typeid(__func::__block_type))
803807
return &__f_;
804808
return (const void*)nullptr;
805809
}
806810

807-
virtual const std::type_info& target_type() const _NOEXCEPT { return typeid(__func::__block_type); }
811+
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const std::type_info& target_type() const _NOEXCEPT {
812+
return typeid(__func::__block_type);
813+
}
808814
# endif // _LIBCPP_HAS_NO_RTTI
809815
};
810816

0 commit comments

Comments
 (0)