summaryrefslogtreecommitdiff
path: root/gcc/langhooks.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2002-04-03 22:26:37 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2002-04-03 22:26:37 +0000
commitd1f6c8f2a0903dd9e0f7e63a40afb5073829dca3 (patch)
treea01f3b59f8231281416c086ab666faaa4b32176c /gcc/langhooks.c
parente715c863746c12d71c9042350fc7e6b9f3a85908 (diff)
downloadgcc-d1f6c8f2a0903dd9e0f7e63a40afb5073829dca3.tar.gz
* langhooks-def.h (lhd_set_decl_assembler_name,
LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): New. (LANG_HOOKS_INITIALIZER): Update. * langhooks.c (lhd_set_decl_assembler_name): New, from tree.c * langhooks.h (struct lang_hooks): New hook. * tree.c (set_decl_assembler_name): Move to langhooks.c. (lang_set_decl_assembler_name): Remove. (init_obstacks): Don't set hook. (decl_assembler_name): New function. * tree.h (DECL_ASSEMBLER_NAME): Turn into a function call. (decl_assembler_name): New. (lang_set_decl_assembler_name): Remove. cp: * cp-lang.c (LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): Redefine. * tree.c (init_tree): Don't set hook. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@51817 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/langhooks.c')
-rw-r--r--gcc/langhooks.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index 92877117e5d..4cdb8abee78 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -123,6 +123,33 @@ lhd_set_yydebug (value)
fprintf (stderr, "warning: no yacc/bison-generated output to debug!\n");
}
+/* Set the DECL_ASSEMBLER_NAME for DECL. */
+void
+lhd_set_decl_assembler_name (decl)
+ tree decl;
+{
+ /* The language-independent code should never use the
+ DECL_ASSEMBLER_NAME for lots of DECLs. Only FUNCTION_DECLs and
+ VAR_DECLs for variables with static storage duration need a real
+ DECL_ASSEMBLER_NAME. */
+ if (TREE_CODE (decl) == FUNCTION_DECL
+ || (TREE_CODE (decl) == VAR_DECL
+ && (TREE_STATIC (decl)
+ || DECL_EXTERNAL (decl)
+ || TREE_PUBLIC (decl))))
+ /* By default, assume the name to use in assembly code is the
+ same as that used in the source language. (That's correct
+ for C, and GCC used to set DECL_ASSEMBLER_NAME to the same
+ value as DECL_NAME in build_decl, so this choice provides
+ backwards compatibility with existing front-ends. */
+ SET_DECL_ASSEMBLER_NAME (decl, DECL_NAME (decl));
+ else
+ /* Nobody should ever be asking for the DECL_ASSEMBLER_NAME of
+ these DECLs -- unless they're in language-dependent code, in
+ which case set_decl_assembler_name hook should handle things. */
+ abort ();
+}
+
/* Provide a default routine to clear the binding stack. This is used
by languages that don't need to do anything special. */
void