static dw_die_ref add_abstract_origin_attribute (dw_die_ref, tree);
static void add_pure_or_virtual_attribute (dw_die_ref, tree);
static void add_src_coords_attributes (dw_die_ref, tree);
-static void add_name_and_src_coords_attributes (dw_die_ref, tree);
+static void add_name_and_src_coords_attributes (dw_die_ref, tree, bool = false);
static void add_discr_value (dw_die_ref, dw_discr_value *);
static void add_discr_list (dw_die_ref, dw_discr_list_ref);
static inline dw_discr_list_ref AT_discr_list (dw_attr_node *);
given decl, but only if it actually has a name. */
static void
-add_name_and_src_coords_attributes (dw_die_ref die, tree decl)
+add_name_and_src_coords_attributes (dw_die_ref die, tree decl,
+ bool no_linkage_name)
{
tree decl_name;
if (! DECL_ARTIFICIAL (decl))
add_src_coords_attributes (die, decl);
- add_linkage_name (die, decl);
+ if (!no_linkage_name)
+ add_linkage_name (die, decl);
}
#ifdef VMS_DEBUGGING_INFO
bool declaration = (DECL_EXTERNAL (decl_or_origin)
|| class_or_namespace_scope_p (context_die));
bool specialization_p = false;
+ bool no_linkage_name = false;
+
+ /* While C++ inline static data members have definitions inside of the
+ class, force the first DIE to be a declaration, then let gen_member_die
+ reparent it to the class context and call gen_variable_die again
+ to create the outside of the class DIE for the definition. */
+ if (!declaration
+ && old_die == NULL
+ && decl
+ && DECL_CONTEXT (decl)
+ && TYPE_P (DECL_CONTEXT (decl))
+ && lang_hooks.decls.decl_dwarf_attribute (decl, DW_AT_inline) != -1)
+ {
+ declaration = true;
+ no_linkage_name = true;
+ }
ultimate_origin = decl_ultimate_origin (decl_or_origin);
if (decl || ultimate_origin)
}
}
else
- add_name_and_src_coords_attributes (var_die, decl);
+ add_name_and_src_coords_attributes (var_die, decl, no_linkage_name);
if ((origin == NULL && !specialization_p)
|| (origin != NULL
&& lang_hooks.decls.decl_dwarf_attribute (decl_or_origin,
DW_AT_const_expr) == 1
&& !get_AT (var_die, DW_AT_const_expr)
- && (origin_die == NULL || get_AT (origin_die, DW_AT_const_expr) == NULL)
&& !specialization_p)
add_AT_flag (var_die, DW_AT_const_expr, 1);
+
+ if (!dwarf_strict)
+ {
+ int inl = lang_hooks.decls.decl_dwarf_attribute (decl_or_origin,
+ DW_AT_inline);
+ if (inl != -1
+ && !get_AT (var_die, DW_AT_inline)
+ && !specialization_p)
+ add_AT_unsigned (var_die, DW_AT_inline, inl);
+ }
}
/* Generate a DIE to represent a named constant. */
vlr_ctx.variant_part_offset = NULL_TREE;
gen_decl_die (member, NULL, &vlr_ctx, context_die);
}
+
+ /* For C++ inline static data members emit immediately a DW_TAG_variable
+ DIE that will refer to that DW_TAG_member through
+ DW_AT_specification. */
+ if (TREE_STATIC (member)
+ && (lang_hooks.decls.decl_dwarf_attribute (member, DW_AT_inline)
+ != -1))
+ {
+ int old_extern = DECL_EXTERNAL (member);
+ DECL_EXTERNAL (member) = 0;
+ gen_decl_die (member, NULL, NULL, comp_unit_die ());
+ DECL_EXTERNAL (member) = old_extern;
+ }
}
/* We do not keep type methods in type variants. */
--- /dev/null
+// { dg-do compile }
+// { dg-options "-O -std=c++1z -g -dA -gno-strict-dwarf" }
+// { dg-require-weak "" }
+// { dg-final { scan-assembler-times "0x3\[^\n\r]* DW_AT_inline" 6 } }
+// { dg-final { scan-assembler-times "0x1\[^\n\r]* DW_AT_inline" 2 } }
+// { dg-final { scan-assembler-times " DW_AT_declaration" 6 } }
+// { dg-final { scan-assembler-times " DW_AT_specification" 6 } }
+// { dg-final { scan-assembler-times " DW_AT_\[^\n\r]*linkage_name" 7 } }
+
+inline int a;
+struct S
+{
+ static inline double b = 4.0;
+ static constexpr int c = 2;
+ static constexpr inline char d = 3;
+} s;
+template <int N>
+inline int e = N;
+int &f = e<2>;
+template <int N>
+struct T
+{
+ static inline double g = 4.0;
+ static constexpr int h = 2;
+ static inline constexpr char i = 3;
+};
+T<5> t;