aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-12-02 07:40:49 -0800
committerNathan Sidwell <nathan@acm.org>2020-12-02 07:40:49 -0800
commit0fc6469d2491bb588d02c5416b5be0131aa4c3b0 (patch)
treea823063a1d4f0de501ab38a024b0821d29bb4739 /gcc
parent329ae1d7751346ba166d34e77a43e8cc33daa1c9 (diff)
downloadgcc-0fc6469d2491bb588d02c5416b5be0131aa4c3b0.zip
gcc-0fc6469d2491bb588d02c5416b5be0131aa4c3b0.tar.gz
gcc-0fc6469d2491bb588d02c5416b5be0131aa4c3b0.tar.bz2
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/lex.c13
2 files changed, 8 insertions, 7 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index ae1147d..4eaa10b 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 21e33d6..795f571 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)
{