From: Nathan Sidwell Date: Wed, 2 Dec 2020 15:40:49 +0000 (-0800) Subject: c++: Add lang_decl, type_decl API X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0fc6469d2491bb588d02c5416b5be0131aa4c3b0;p=gcc.git c++: Add lang_decl, type_decl API We need to call the lang_decl and type_decl creators from the module loading machinery. This makes them reachable. gcc/cp/ * cp-tree.h (maybe_add_lang_decl_raw, maybe_add_lang_type_raw): Declare. * lex.c (maybe_add_lang_decl_raw, maybe_add_lang_type_raw): Externalize, reformat. --- diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index ae1147d4589..4eaa10bc7fd 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -6759,6 +6759,8 @@ extern tree unqualified_fn_lookup_error (cp_expr); extern tree make_conv_op_name (tree); extern tree build_lang_decl (enum tree_code, tree, tree); extern tree build_lang_decl_loc (location_t, enum tree_code, tree, tree); +extern bool maybe_add_lang_decl_raw (tree, bool decomp_p); +extern bool maybe_add_lang_type_raw (tree); extern void retrofit_lang_decl (tree); extern void fit_decomposition_lang_decl (tree, tree); extern tree copy_decl (tree CXX_MEM_STAT_INFO); diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 21e33d69c08..795f5718198 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -680,7 +680,7 @@ build_lang_decl_loc (location_t loc, enum tree_code code, tree name, tree type) /* Maybe add a raw lang_decl to T, a decl. Return true if it needed one. */ -static bool +bool maybe_add_lang_decl_raw (tree t, bool decomp_p) { size_t size; @@ -833,8 +833,7 @@ copy_lang_type (tree node) if (! TYPE_LANG_SPECIFIC (node)) return; - struct lang_type *lt - = (struct lang_type *) ggc_internal_alloc (sizeof (struct lang_type)); + auto *lt = (struct lang_type *) ggc_internal_alloc (sizeof (struct lang_type)); memcpy (lt, TYPE_LANG_SPECIFIC (node), (sizeof (struct lang_type))); TYPE_LANG_SPECIFIC (node) = lt; @@ -860,15 +859,15 @@ copy_type (tree type MEM_STAT_DECL) /* Add a raw lang_type to T, a type, should it need one. */ -static bool +bool maybe_add_lang_type_raw (tree t) { if (!RECORD_OR_UNION_CODE_P (TREE_CODE (t))) return false; - TYPE_LANG_SPECIFIC (t) - = (struct lang_type *) (ggc_internal_cleared_alloc - (sizeof (struct lang_type))); + auto *lt = (struct lang_type *) (ggc_internal_cleared_alloc + (sizeof (struct lang_type))); + TYPE_LANG_SPECIFIC (t) = lt; if (GATHER_STATISTICS) {