aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2017-11-16 14:54:54 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2017-11-16 14:54:54 +0000
commit5f3682ffcef162363b783eb9ee702debff489fa8 (patch)
treeb9e4f1042a3c4558c07ba463d34ee29d68c28a6e /gcc/tree.h
parenta930324dabd41a76ef141a85a7d0cc7fc9c9c0b3 (diff)
downloadgcc-5f3682ffcef162363b783eb9ee702debff489fa8.zip
gcc-5f3682ffcef162363b783eb9ee702debff489fa8.tar.gz
gcc-5f3682ffcef162363b783eb9ee702debff489fa8.tar.bz2
[PATCH] New lang hook
https://gcc.gnu.org/ml/gcc-patches/2017-11/msg01340.html PR c++/82836 PR c++/82737 * tree.h (COPY_DECL_RTL): Rename parms for clarity. (SET_DECL_ASSEMBLER_NAME): Forward to overwrite_decl_assembler_name. (COPY_DECL_ASSEMBLER_NAME): Rename parms for clarity. (overwrite_decl_assembler_name): Declare. * tree.c (overwrite_decl_assembler_name): New. * langhooks-def.h (lhd_overwrite_decl_assembler_name): Declare. (LANG_HOOKS_OVERWRITE_DECL_ASSEMBLER_NAME): Provide default. (LANG_HOOKS_INITIALIZER): Add it. * langhooks.h (struct lang_hooks): Add overwrite_decl_assembler_name. * langhooks.c (lhd_set_decl_assembler_name): Use SET_DECL_ASSEMBLER_NAME. (lhd_overwrite_decl_assembler_name): Default implementation. PR c++/82836 PR c++/82737 * cp-objcp-common.h (LANG_HOOKS_OVERWRITE_DECL_ASSEMBLER_NAME): Override. * cp-tree.h (overwrite_mangling): Declare. * decl2.c (struct mangled_decl_hash): Entries are deletable. (overwrite_mangling): New. PR c++/82836 PR c++/82737 * g++.dg/pr82836.C: New. From-SVN: r254823
Diffstat (limited to 'gcc/tree.h')
-rw-r--r--gcc/tree.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/gcc/tree.h b/gcc/tree.h
index 39acffe..0ec092a 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -2528,11 +2528,11 @@ extern void decl_value_expr_insert (tree, tree);
#define DECL_RTL_SET_P(NODE) \
(HAS_RTL_P (NODE) && DECL_WRTL_CHECK (NODE)->decl_with_rtl.rtl != NULL)
-/* Copy the RTL from NODE1 to NODE2. If the RTL was not set for
- NODE1, it will not be set for NODE2; this is a lazy copy. */
-#define COPY_DECL_RTL(NODE1, NODE2) \
- (DECL_WRTL_CHECK (NODE2)->decl_with_rtl.rtl \
- = DECL_WRTL_CHECK (NODE1)->decl_with_rtl.rtl)
+/* Copy the RTL from SRC_DECL to DST_DECL. If the RTL was not set for
+ SRC_DECL, it will not be set for DST_DECL; this is a lazy copy. */
+#define COPY_DECL_RTL(SRC_DECL, DST_DECL) \
+ (DECL_WRTL_CHECK (DST_DECL)->decl_with_rtl.rtl \
+ = DECL_WRTL_CHECK (SRC_DECL)->decl_with_rtl.rtl)
/* The DECL_RTL for NODE, if it is set, or NULL, if it is not set. */
#define DECL_RTL_IF_SET(NODE) (DECL_RTL_SET_P (NODE) ? DECL_RTL (NODE) : NULL)
@@ -2723,19 +2723,21 @@ extern void decl_value_expr_insert (tree, tree);
/* Set the DECL_ASSEMBLER_NAME for NODE to NAME. */
#define SET_DECL_ASSEMBLER_NAME(NODE, NAME) \
- (DECL_ASSEMBLER_NAME_RAW (NODE) = (NAME))
+ overwrite_decl_assembler_name (NODE, NAME)
-/* Copy the DECL_ASSEMBLER_NAME from DECL1 to DECL2. Note that if DECL1's
- DECL_ASSEMBLER_NAME has not yet been set, using this macro will not cause
- the DECL_ASSEMBLER_NAME of either DECL to be set. In other words, the
- semantics of using this macro, are different than saying:
+/* Copy the DECL_ASSEMBLER_NAME from SRC_DECL to DST_DECL. Note that
+ if SRC_DECL's DECL_ASSEMBLER_NAME has not yet been set, using this
+ macro will not cause the DECL_ASSEMBLER_NAME to be set, but will
+ clear DECL_ASSEMBLER_NAME of DST_DECL, if it was already set. In
+ other words, the semantics of using this macro, are different than
+ saying:
- SET_DECL_ASSEMBLER_NAME(DECL2, DECL_ASSEMBLER_NAME (DECL1))
+ SET_DECL_ASSEMBLER_NAME(DST_DECL, DECL_ASSEMBLER_NAME (SRC_DECL))
- which will try to set the DECL_ASSEMBLER_NAME for DECL1. */
+ which will try to set the DECL_ASSEMBLER_NAME for SRC_DECL. */
-#define COPY_DECL_ASSEMBLER_NAME(DECL1, DECL2) \
- SET_DECL_ASSEMBLER_NAME (DECL2, DECL_ASSEMBLER_NAME_RAW (DECL1))
+#define COPY_DECL_ASSEMBLER_NAME(SRC_DECL, DST_DECL) \
+ SET_DECL_ASSEMBLER_NAME (DST_DECL, DECL_ASSEMBLER_NAME_RAW (SRC_DECL))
/* Records the section name in a section attribute. Used to pass
the name from decl_attributes to make_function_rtl and make_decl_rtl. */
@@ -3872,6 +3874,7 @@ id_equal (const char *str, const_tree id)
|| ((NODE) && TREE_TYPE ((NODE)) == error_mark_node))
extern tree decl_assembler_name (tree);
+extern void overwrite_decl_assembler_name (tree decl, tree name);
extern tree decl_comdat_group (const_tree);
extern tree decl_comdat_group_id (const_tree);
extern const char *decl_section_name (const_tree);