[libcxx-commits] [libcxx] 03cf122 - [libc++] Add a few _LIBCPP_HIDE_FROM_ABI which have been accidentally removed in #201722 (#236733)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 30 06:12:58 PDT 2026


Author: Nikolas Klauser
Date: 2026-10-30T14:12:53+01:00
New Revision: 03cf1225b8654884db822f4030416802c963aa5a

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

LOG: [libc++] Add a few _LIBCPP_HIDE_FROM_ABI which have been accidentally removed in #201722 (#236733)

These annotations should have stayed, since the functions are in a spot
where explicit annotation are required.

Added: 
    

Modified: 
    libcxx/include/__chrono/exception.h
    libcxx/include/__condition_variable/condition_variable.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__chrono/exception.h b/libcxx/include/__chrono/exception.h
index 39347f9ebdec98..27fbfd6b57a2bb 100644
--- a/libcxx/include/__chrono/exception.h
+++ b/libcxx/include/__chrono/exception.h
@@ -40,7 +40,7 @@ namespace chrono {
 class nonexistent_local_time : public runtime_error {
 public:
   template <class _Duration>
-  nonexistent_local_time(const local_time<_Duration>& __time, const local_info& __info)
+  _LIBCPP_HIDE_FROM_ABI nonexistent_local_time(const local_time<_Duration>& __time, const local_info& __info)
       : runtime_error{__create_message(__time, __info)} {
     // [time.zone.exception.nonexist]/2
     //   Preconditions: i.result == local_info::nonexistent is true.
@@ -49,14 +49,14 @@ class nonexistent_local_time : public runtime_error {
                             "creating an nonexistent_local_time from a local_info that is not non-existent");
   }
 
-  nonexistent_local_time(const nonexistent_local_time&)            = default;
-  nonexistent_local_time& operator=(const nonexistent_local_time&) = default;
+  _LIBCPP_HIDE_FROM_ABI nonexistent_local_time(const nonexistent_local_time&)            = default;
+  _LIBCPP_HIDE_FROM_ABI nonexistent_local_time& operator=(const nonexistent_local_time&) = default;
 
   _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI ~nonexistent_local_time() override; // exported as key function
 
 private:
   template <class _Duration>
-  string __create_message(const local_time<_Duration>& __time, const local_info& __info) {
+  _LIBCPP_HIDE_FROM_ABI string __create_message(const local_time<_Duration>& __time, const local_info& __info) {
     return std::format(
         R"({} is in a gap between
 {} {} and
@@ -72,7 +72,7 @@ class nonexistent_local_time : public runtime_error {
 };
 
 template <class _Duration>
-[[noreturn]] _LIBCPP_AVAILABILITY_TZDB void __throw_nonexistent_local_time(
+[[noreturn]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_nonexistent_local_time(
     [[maybe_unused]] const local_time<_Duration>& __time, [[maybe_unused]] const local_info& __info) {
 #    if _LIBCPP_HAS_EXCEPTIONS
   throw nonexistent_local_time(__time, __info);
@@ -84,7 +84,7 @@ template <class _Duration>
 class ambiguous_local_time : public runtime_error {
 public:
   template <class _Duration>
-  ambiguous_local_time(const local_time<_Duration>& __time, const local_info& __info)
+  _LIBCPP_HIDE_FROM_ABI ambiguous_local_time(const local_time<_Duration>& __time, const local_info& __info)
       : runtime_error{__create_message(__time, __info)} {
     // [time.zone.exception.ambig]/2
     //   Preconditions: i.result == local_info::ambiguous is true.
@@ -93,14 +93,14 @@ class ambiguous_local_time : public runtime_error {
                             "creating an ambiguous_local_time from a local_info that is not ambiguous");
   }
 
-  ambiguous_local_time(const ambiguous_local_time&)            = default;
-  ambiguous_local_time& operator=(const ambiguous_local_time&) = default;
+  _LIBCPP_HIDE_FROM_ABI ambiguous_local_time(const ambiguous_local_time&)            = default;
+  _LIBCPP_HIDE_FROM_ABI ambiguous_local_time& operator=(const ambiguous_local_time&) = default;
 
   _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI ~ambiguous_local_time() override; // exported as key function
 
 private:
   template <class _Duration>
-  string __create_message(const local_time<_Duration>& __time, const local_info& __info) {
+  _LIBCPP_HIDE_FROM_ABI string __create_message(const local_time<_Duration>& __time, const local_info& __info) {
     return std::format(
         // There are two spaces after the full-stop; this has been verified
         // in the sources of the Standard.
@@ -116,7 +116,7 @@ class ambiguous_local_time : public runtime_error {
 };
 
 template <class _Duration>
-[[noreturn]] _LIBCPP_AVAILABILITY_TZDB void __throw_ambiguous_local_time(
+[[noreturn]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_ambiguous_local_time(
     [[maybe_unused]] const local_time<_Duration>& __time, [[maybe_unused]] const local_info& __info) {
 #    if _LIBCPP_HAS_EXCEPTIONS
   throw ambiguous_local_time(__time, __info);

diff  --git a/libcxx/include/__condition_variable/condition_variable.h b/libcxx/include/__condition_variable/condition_variable.h
index ab3cbdf5711e15..30a96d9054464b 100644
--- a/libcxx/include/__condition_variable/condition_variable.h
+++ b/libcxx/include/__condition_variable/condition_variable.h
@@ -49,7 +49,7 @@ _LIBCPP_DECLARE_STRONG_ENUM(cv_status){no_timeout, timeout};
 _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status)
 
 template <class _Rep, class _Period, __enable_if_t<is_floating_point<_Rep>::value, int> = 0>
-inline chrono::nanoseconds __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) {
+inline _LIBCPP_HIDE_FROM_ABI chrono::nanoseconds __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) {
   using namespace chrono;
   using __ratio       = ratio_divide<_Period, nano>;
   using __ns_rep      = nanoseconds::rep;
@@ -69,7 +69,7 @@ inline chrono::nanoseconds __safe_nanosecond_cast(chrono::duration<_Rep, _Period
 }
 
 template <class _Rep, class _Period, __enable_if_t<!is_floating_point<_Rep>::value, int> = 0>
-inline chrono::nanoseconds __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) {
+inline _LIBCPP_HIDE_FROM_ABI chrono::nanoseconds __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) {
   using namespace chrono;
   if (__d.count() == 0) {
     return nanoseconds(0);
@@ -96,7 +96,7 @@ inline chrono::nanoseconds __safe_nanosecond_cast(chrono::duration<_Rep, _Period
 }
 
 template <class _Duration>
-chrono::steady_clock::time_point __rel_to_abs(const _Duration& __rel_time) {
+_LIBCPP_HIDE_FROM_ABI chrono::steady_clock::time_point __rel_to_abs(const _Duration& __rel_time) {
   return chrono::steady_clock::now() + chrono::__ceil<chrono::steady_clock::duration>(__rel_time);
 }
 
@@ -118,7 +118,7 @@ class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_WARN_UNUSED condition_variable {
   __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER;
 
 public:
-  _LIBCPP_CONSTEXPR condition_variable() _NOEXCEPT = default;
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR condition_variable() _NOEXCEPT = default;
 
 #  if _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
   ~condition_variable() = default;
@@ -135,13 +135,14 @@ class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_WARN_UNUSED condition_variable {
   void wait(unique_lock<mutex>& __lk) _NOEXCEPT;
 
   template <class _Predicate>
-  void wait(unique_lock<mutex>& __lk, _Predicate __pred) {
+  _LIBCPP_HIDE_FROM_ABI void wait(unique_lock<mutex>& __lk, _Predicate __pred) {
     while (!__pred())
       wait(__lk);
   }
 
   template <class _Clock, class _Duration>
-  cv_status wait_until(unique_lock<mutex>& __lk, const chrono::time_point<_Clock, _Duration>& __t) {
+  _LIBCPP_HIDE_FROM_ABI cv_status
+  wait_until(unique_lock<mutex>& __lk, const chrono::time_point<_Clock, _Duration>& __t) {
     using namespace chrono;
     using __clock_tp_ns = time_point<_Clock, nanoseconds>;
 
@@ -156,7 +157,8 @@ class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_WARN_UNUSED condition_variable {
   }
 
   template <class _Clock, class _Duration, class _Predicate>
-  bool wait_until(unique_lock<mutex>& __lk, const chrono::time_point<_Clock, _Duration>& __t, _Predicate __pred) {
+  _LIBCPP_HIDE_FROM_ABI bool
+  wait_until(unique_lock<mutex>& __lk, const chrono::time_point<_Clock, _Duration>& __t, _Predicate __pred) {
     while (!__pred()) {
       if (wait_until(__lk, __t) == cv_status::timeout)
         return __pred();
@@ -165,25 +167,27 @@ class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_WARN_UNUSED condition_variable {
   }
 
   template <class _Rep, class _Period>
-  cv_status wait_for(unique_lock<mutex>& __lk, const chrono::duration<_Rep, _Period>& __d) {
+  _LIBCPP_HIDE_FROM_ABI cv_status wait_for(unique_lock<mutex>& __lk, const chrono::duration<_Rep, _Period>& __d) {
     return wait_until(__lk, std::__rel_to_abs(__d));
   }
 
   template <class _Rep, class _Period, class _Predicate>
-  bool wait_for(unique_lock<mutex>& __lk, const chrono::duration<_Rep, _Period>& __d, _Predicate __pred);
+  _LIBCPP_HIDE_FROM_ABI bool
+  wait_for(unique_lock<mutex>& __lk, const chrono::duration<_Rep, _Period>& __d, _Predicate __pred);
 
   typedef __libcpp_condvar_t* native_handle_type;
-  [[__nodiscard__]] native_handle_type native_handle() { return &__cv_; }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return &__cv_; }
 
 private:
   void
   __do_timed_wait(unique_lock<mutex>& __lk, chrono::time_point<chrono::system_clock, chrono::nanoseconds>) _NOEXCEPT;
 #  if _LIBCPP_HAS_COND_CLOCKWAIT
-  void
+  _LIBCPP_HIDE_FROM_ABI void
   __do_timed_wait(unique_lock<mutex>& __lk, chrono::time_point<chrono::steady_clock, chrono::nanoseconds>) _NOEXCEPT;
 #  endif
   template <class _Clock>
-  void __do_timed_wait(unique_lock<mutex>& __lk, chrono::time_point<_Clock, chrono::nanoseconds>) _NOEXCEPT;
+  _LIBCPP_HIDE_FROM_ABI void
+  __do_timed_wait(unique_lock<mutex>& __lk, chrono::time_point<_Clock, chrono::nanoseconds>) _NOEXCEPT;
 };
 #endif // _LIBCPP_HAS_THREADS
 


        


More information about the libcxx-commits mailing list