[libcxx-commits] [libcxx] [libc++] Add default copy ctor to "__chrono/exception.h" (PR #95338)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 12 18:59:11 PDT 2024


https://github.com/zeroomega updated https://github.com/llvm/llvm-project/pull/95338

>From 5fb1497990d3171d0cb6167574436ed9d8f20779 Mon Sep 17 00:00:00 2001
From: Haowei Wu <haowei at google.com>
Date: Wed, 12 Jun 2024 17:33:23 -0700
Subject: [PATCH 1/2] [libc++] Add default copy ctor to "__chrono/exception.h"

After PR#90394, "__chrono/exception.h" will trigger
"deprecated-copy-with-user-provided-dtor" warning on Windows x64
runtime testing with ToT Clang. This patch addresses this issue by
explicitly adding those default copy ctors.
---
 libcxx/include/__chrono/exception.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libcxx/include/__chrono/exception.h b/libcxx/include/__chrono/exception.h
index 75fd0615b7e08..fe3619ca22f8c 100644
--- a/libcxx/include/__chrono/exception.h
+++ b/libcxx/include/__chrono/exception.h
@@ -48,6 +48,9 @@ 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_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI ~nonexistent_local_time() override; // exported as key function
 
 private:
@@ -89,6 +92,9 @@ 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_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI ~ambiguous_local_time() override; // exported as key function
 
 private:

>From c466e99160b951dbe99b3d195714e8a6c89f634e Mon Sep 17 00:00:00 2001
From: Haowei Wu <haowei at google.com>
Date: Wed, 12 Jun 2024 18:58:19 -0700
Subject: [PATCH 2/2] amend! [libc++] Add default copy ctor to
 "__chrono/exception.h"

Add required attributes to fix test failures

[libc++] Add default copy ctor to "__chrono/exception.h"

After PR#90394, "__chrono/exception.h" will trigger
"deprecated-copy-with-user-provided-dtor" warning on Windows x64
runtime testing with ToT Clang. This patch addresses this issue by
explicitly adding those default copy ctors.
---
 libcxx/include/__chrono/exception.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libcxx/include/__chrono/exception.h b/libcxx/include/__chrono/exception.h
index fe3619ca22f8c..266f8fac44176 100644
--- a/libcxx/include/__chrono/exception.h
+++ b/libcxx/include/__chrono/exception.h
@@ -48,8 +48,8 @@ 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
 
@@ -92,8 +92,8 @@ 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
 



More information about the libcxx-commits mailing list