diff options
Diffstat (limited to 'libcxx')
-rw-r--r-- | libcxx/include/__config | 6 | ||||
-rw-r--r-- | libcxx/src/debug.cpp | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config index a7d0b141fa3..ead522520e8 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1120,6 +1120,12 @@ template <unsigned> struct __static_assert_check {}; #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 *); diff --git a/libcxx/src/debug.cpp b/libcxx/src/debug.cpp index 93fa1a8e0d4..7fdf90c37d9 100644 --- a/libcxx/src/debug.cpp +++ b/libcxx/src/debug.cpp @@ -42,7 +42,7 @@ _LIBCPP_FUNC_VIS __libcpp_db* __get_db() { - static __libcpp_db db; + static _LIBCPP_NO_DESTROY __libcpp_db db; return &db; } @@ -64,7 +64,7 @@ typedef lock_guard<mutex_type> RLock; mutex_type& mut() { - static mutex_type m; + static _LIBCPP_NO_DESTROY mutex_type m; return m; } #endif // !_LIBCPP_HAS_NO_THREADS |