[libcxx-commits] [PATCH] D60830: [libc++] Use the no_destroy attribute to avoid destroying debug DB statics

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 17 11:21:27 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rCXX358602: [libc++] Use the no_destroy attribute to avoid destroying debug DB statics (authored by ldionne, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D60830?vs=195592&id=195603#toc

Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60830/new/

https://reviews.llvm.org/D60830

Files:
  include/__config
  src/debug.cpp


Index: src/debug.cpp
===================================================================
--- src/debug.cpp
+++ src/debug.cpp
@@ -42,7 +42,7 @@
 __libcpp_db*
 __get_db()
 {
-    static __libcpp_db db;
+    static _LIBCPP_NO_DESTROY __libcpp_db db;
     return &db;
 }
 
@@ -64,7 +64,7 @@
 mutex_type&
 mut()
 {
-    static mutex_type m;
+    static _LIBCPP_NO_DESTROY mutex_type m;
     return m;
 }
 #endif // !_LIBCPP_HAS_NO_THREADS
Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -1120,6 +1120,12 @@
 #endif
 #endif
 
+#if __has_attribute(no_destroy)
+#  define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__))
+#else
+#  define _LIBCPP_NO_DESTROY
+#endif
+
 #ifndef _LIBCPP_HAS_NO_ASAN
 _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
   const void *, const void *, const void *, const void *);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60830.195603.patch
Type: text/x-patch
Size: 917 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190417/3e3434b7/attachment.bin>


More information about the libcxx-commits mailing list