[libcxx-commits] [libcxx] 7c2f582 - Apply [[standalone_debug]] to some types in the STL.

Amy Huang via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 18 17:11:01 PDT 2021


Author: Amy Huang
Date: 2021-05-18T17:01:07-07:00
New Revision: 7c2f58278e664d336e9d0ef0687bdd6c3837dc03

URL: https://github.com/llvm/llvm-project/commit/7c2f58278e664d336e9d0ef0687bdd6c3837dc03
DIFF: https://github.com/llvm/llvm-project/commit/7c2f58278e664d336e9d0ef0687bdd6c3837dc03.diff

LOG: Apply [[standalone_debug]] to some types in the STL.

Add this attribute to some types to ensure that they have
debug info.
The debug info for these classes are required for debuggers to display
some STL types. With constructor homing (a new debug info optimization)
their debug info isn't emitted because their constructors are never
called.

The list of types with the attribute added are __hash_value_type,
__value_type, __tree_node_base, __tree_node, __hash_node, __list_node,
and __forward_list_node.

Differential Revision: https://reviews.llvm.org/D98750

Added: 
    

Modified: 
    libcxx/include/__config
    libcxx/include/__hash_table
    libcxx/include/__tree
    libcxx/include/forward_list
    libcxx/include/list
    libcxx/include/map
    libcxx/include/unordered_map

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__config b/libcxx/include/__config
index 49255a850f796..30a4f4a9527d7 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1342,6 +1342,12 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
 #endif
 #endif // !defined(_LIBCPP_NODEBUG_TYPE)
 
+#if __has_attribute(__standalone_debug__)
+#define _LIBCPP_STANDALONE_DEBUG __attribute__((__standalone_debug__))
+#else
+#define _LIBCPP_STANDALONE_DEBUG
+#endif
+
 #if __has_attribute(__preferred_name__)
 #define _LIBCPP_PREFERRED_NAME(x) __attribute__((__preferred_name__(x)))
 #else

diff  --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index 08abe3920c689..ed354405dc278 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -89,7 +89,7 @@ struct __hash_node_base
 };
 
 template <class _Tp, class _VoidPtr>
-struct __hash_node
+struct _LIBCPP_STANDALONE_DEBUG __hash_node
     : public __hash_node_base
              <
                  typename __rebind_pointer<_VoidPtr, __hash_node<_Tp, _VoidPtr> >::type

diff  --git a/libcxx/include/__tree b/libcxx/include/__tree
index 439992ee21fe8..70f3a276773a2 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -714,7 +714,7 @@ public:
 };
 
 template <class _VoidPtr>
-class __tree_node_base
+class _LIBCPP_STANDALONE_DEBUG __tree_node_base
     : public __tree_node_base_types<_VoidPtr>::__end_node_type
 {
     typedef __tree_node_base_types<_VoidPtr> _NodeBaseTypes;
@@ -742,7 +742,7 @@ private:
 };
 
 template <class _Tp, class _VoidPtr>
-class __tree_node
+class _LIBCPP_STANDALONE_DEBUG __tree_node
     : public __tree_node_base<_VoidPtr>
 {
 public:

diff  --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index ef0f70ab795c9..39ffac31a555a 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -272,7 +272,7 @@ struct _LIBCPP_HIDDEN __begin_node_of
 };
 
 template <class _Tp, class _VoidPtr>
-struct __forward_list_node
+struct _LIBCPP_STANDALONE_DEBUG __forward_list_node
     : public __begin_node_of<_Tp, _VoidPtr>::type
 {
     typedef _Tp value_type;

diff  --git a/libcxx/include/list b/libcxx/include/list
index b4cc649c47338..b1c9746e72fa7 100644
--- a/libcxx/include/list
+++ b/libcxx/include/list
@@ -267,7 +267,7 @@ struct __list_node_base
 };
 
 template <class _Tp, class _VoidPtr>
-struct __list_node
+struct _LIBCPP_STANDALONE_DEBUG __list_node
     : public __list_node_base<_Tp, _VoidPtr>
 {
     _Tp __value_;

diff  --git a/libcxx/include/map b/libcxx/include/map
index 065d1d17aa455..4512dbd5aed64 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -667,7 +667,7 @@ template <class _TreeIterator> class __map_const_iterator;
 #ifndef _LIBCPP_CXX03_LANG
 
 template <class _Key, class _Tp>
-struct __value_type
+struct _LIBCPP_STANDALONE_DEBUG __value_type
 {
     typedef _Key                                     key_type;
     typedef _Tp                                      mapped_type;

diff  --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index 8b0bea3b5c1c4..a93a6525c66ec 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -702,7 +702,7 @@ public:
 
 #ifndef _LIBCPP_CXX03_LANG
 template <class _Key, class _Tp>
-struct __hash_value_type
+struct _LIBCPP_STANDALONE_DEBUG __hash_value_type
 {
     typedef _Key                                     key_type;
     typedef _Tp                                      mapped_type;


        


More information about the libcxx-commits mailing list