aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2001-03-19 23:50:04 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2001-03-19 23:50:04 +0000
commit92643fea9381b2d137f19d19e28e24a61dc44b0c (patch)
tree0e001bd33ab3dcdd688aa773f49f4ddf63c89df6 /gcc/cp/decl2.c
parentb90f4049d36e101e2090dd2c1a0595bdb3790ec2 (diff)
downloadgcc-92643fea9381b2d137f19d19e28e24a61dc44b0c.zip
gcc-92643fea9381b2d137f19d19e28e24a61dc44b0c.tar.gz
gcc-92643fea9381b2d137f19d19e28e24a61dc44b0c.tar.bz2
Compute DECL_ASSEMBLER_NAME lazily.
* tree.h (DECL_ASSEMBLER_NAME): Compute it lazily. (DECL_ASSEMBLER_NAME_SET_P): New macro. (SET_DECL_ASSEMBLER_NAME): Likewise. (COPY_DECL_ASSEMBLER_NAME): Likewise. (set_decl_assembler_name): Declare. (lang_set_decl_assembler_name): Likewise. * tree.c (lang_set_decl_assembler_name): New variab.e (set_decl_assembler_name): New function. (init_obstacks): Set lang_set_decl_assembler_name. (build_decl): Don't set DECL_ASSEMBLER_NAME. * c-decl.c (duplicate_decls): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (builtin_function): Likewise. (finish_decl): Likewise. * dbxout.c (dbxout_type_methods): Likewise. * ggc-common.c (ggc_mark_trees): Likewise. * profile.c (output_func_start_profiler): Likewise. * varasm.c (make_decl_rtl): Likewise. * class.c (get_vtable_decl): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (add_method): Remove optimization involving comparison of DECL_ASSEMBLER_NAME. (build_vtbl_or_vbase_field): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (check_methods): Likewise. (build_clone): Likewise. (built_vtt): Likewise. * cp-tree.h (DECL_NEEDED_P): Likewise. * decl.c (pushtag): Likewise. (duplicate_decls): Likewise. (pushdecl): Likewise. (builtin_function): Likewise. (build_library_fn_1): Set DECL_LANGUAGE for library functions. (build_cp_library_fn): Likewise. (maybe_commonize_var): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (make_rtl_for_nonlocal_decl): Likewise. (cp_finish_decl): Likewise. (grokfndecl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (start_function): Likewise. (cp_missing_return_ok_p): Likewise. * decl2.c (grokclassfn): Likewise. (check_classfn): Likewise. (finish_static_data_member_decl): Likewise. (grokfield): Likewise. * error.c (GLOBAL_IORD_P): Remove. (dump_global_iord): Improve output. (dump_decl): Avoid using DECL_ASSEMBLER_NAME. * except.c (nothrow_libfn_p): Summarily reject any function not in namespace-scope. * init.c (build_java_class_ref): Don't explicitly set DECL_ASSEMBLER_NAME after calling mangle_decl. * mangle.c (mangle_decl_string): Handle extern "C" functions. (mangle_decl): Set the DECL_ASSEMBLER_NAME for the decl. * method.c (set_mangled_name_for_decl): Don't explicitly set DECL_ASSEMBLER_NAME after calling mangle_decl. (make_thunk): Explicitly set the DECL_ASSEMBLER_NAME and IDENTIFIER_GLOBAL_VALUE for the thunk. * pt.c (set_mangled_name_for_template_decl): Remove. (check_explicit_specialization): Don't use it. (looup_template_class): Don't set DECL_ASSEMBLER_NAME. (tsubst_friend_function): Likewise. (tsubst_decl): Likewise. (regenerate_decl_from_template): Use COPY_DECL_ASSEMBLER_NAME. * rtti.c (get_tinfo_decl): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (tinfo_base_init): Likewise. (create_real_tinfo_var): Likewise. * search.c (looup_field_1): Likewise. * semantics.c (finish_named_return_value): Likewise. * tree.c (init_tree): Set lang_set_decl_assembler_name. * com.c (builtin_function): Use SET_DECL_ASSEMBLER_NAME. * class.c (build_class_ref): Use SET_DECL_ASSEMBLER_NAME. (layout_class): Likewise. (layout_class_method): Likewise. (emit_register_classes): Likewise. * decl.c (builtin_function): Likewise. (give_name_to_locals): Likewise. From-SVN: r40642
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c43
1 files changed, 7 insertions, 36 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index b60b669..1487a5b 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1061,17 +1061,17 @@ grokclassfn (ctype, function, flags, quals)
DECL_ARGUMENTS (function) = last_function_parms;
DECL_CONTEXT (function) = ctype;
+ if (flags == DTOR_FLAG)
+ DECL_DESTRUCTOR_P (function) = 1;
+
if (flags == DTOR_FLAG || DECL_CONSTRUCTOR_P (function))
maybe_retrofit_in_chrg (function);
if (flags == DTOR_FLAG)
{
DECL_DESTRUCTOR_P (function) = 1;
- set_mangled_name_for_decl (function);
TYPE_HAS_DESTRUCTOR (ctype) = 1;
}
- else
- set_mangled_name_for_decl (function);
}
/* Work on the expr used by alignof (this is only called by the parser). */
@@ -1436,22 +1436,6 @@ check_classfn (ctype, function)
fndecls = OVL_NEXT (fndecls))
{
fndecl = OVL_CURRENT (fndecls);
- /* The DECL_ASSEMBLER_NAME for a TEMPLATE_DECL, or
- for a for member function of a template class, is
- not mangled, so the check below does not work
- correctly in that case. Since mangled destructor
- names do not include the type of the arguments,
- we can't use this short-cut for them, either.
- (It's not legal to declare arguments for a
- destructor, but some people try.) */
- if (!DECL_DESTRUCTOR_P (function)
- && (DECL_ASSEMBLER_NAME (function)
- != DECL_NAME (function))
- && (DECL_ASSEMBLER_NAME (fndecl)
- != DECL_NAME (fndecl))
- && (DECL_ASSEMBLER_NAME (function)
- == DECL_ASSEMBLER_NAME (fndecl)))
- return fndecl;
/* We cannot simply call decls_match because this
doesn't work for static member functions that are
@@ -1525,11 +1509,6 @@ finish_static_data_member_decl (decl, init, asmspec_tree, flags)
tree asmspec_tree;
int flags;
{
- const char *asmspec = 0;
-
- if (asmspec_tree)
- asmspec = TREE_STRING_POINTER (asmspec_tree);
-
my_friendly_assert (TREE_PUBLIC (decl), 0);
DECL_CONTEXT (decl) = current_class_type;
@@ -1538,11 +1517,9 @@ finish_static_data_member_decl (decl, init, asmspec_tree, flags)
decl of our TREE_CHAIN. Instead, we modify cp_finish_decl to do
the right thing, namely, to put this decl out straight away. */
/* current_class_type can be NULL_TREE in case of error. */
- if (!asmspec && current_class_type)
- {
- DECL_INITIAL (decl) = error_mark_node;
- DECL_ASSEMBLER_NAME (decl) = mangle_decl (decl);
- }
+ if (!asmspec_tree && current_class_type)
+ DECL_INITIAL (decl) = error_mark_node;
+
if (! processing_template_decl)
{
if (!pending_statics)
@@ -1672,12 +1649,6 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
if (CLASS_TYPE_P (TREE_TYPE (value)))
CLASSTYPE_GOT_SEMICOLON (TREE_TYPE (value)) = 1;
- /* Now that we've updated the context, we need to remangle the
- name for this TYPE_DECL. */
- DECL_ASSEMBLER_NAME (value) = DECL_NAME (value);
- if (!uses_template_parms (value))
- DECL_ASSEMBLER_NAME (value) = mangle_type (TREE_TYPE (value));
-
if (processing_template_decl)
value = push_template_decl (value);
@@ -1776,7 +1747,7 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
/* This must override the asm specifier which was placed
by grokclassfn. Lay this out fresh. */
SET_DECL_RTL (value, NULL_RTX);
- DECL_ASSEMBLER_NAME (value) = get_identifier (asmspec);
+ SET_DECL_ASSEMBLER_NAME (value, get_identifier (asmspec));
}
cp_finish_decl (value, init, asmspec_tree, flags);