aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/method.c
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@apple.com>2006-12-01 23:01:05 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>2006-12-01 23:01:05 +0000
commit72c4a4ca45bb4adc746cedd9eba5960b357b6537 (patch)
tree6a7205d17e6c8b71f9549fe22d01ac548d72b018 /gcc/cp/method.c
parent01975fc73d3e6f23fac39e0593363af838980d95 (diff)
downloadgcc-72c4a4ca45bb4adc746cedd9eba5960b357b6537.zip
gcc-72c4a4ca45bb4adc746cedd9eba5960b357b6537.tar.gz
gcc-72c4a4ca45bb4adc746cedd9eba5960b357b6537.tar.bz2
decl.c (poplevel): Check DECL_INITIAL invariant.
* decl.c (poplevel): Check DECL_INITIAL invariant. (duplicate_decls): Preserve DECL_INITIAL when eliminating a new definition in favour of an old declaration. (start_preparsed_function): Define and document value of DECL_INITIAL before and after routine. (finish_function): Check DECL_INITIAL invariant. * parser.c (cp_parser_function_definition_from_specifiers_and_declarator): Skip duplicate function definitions. From-SVN: r119427
Diffstat (limited to 'gcc/cp/method.c')
-rw-r--r--gcc/cp/method.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index ded0af0..71e34f0 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -407,10 +407,6 @@ use_thunk (tree thunk_fndecl, bool emit_p)
}
}
- /* The back-end expects DECL_INITIAL to contain a BLOCK, so we
- create one. */
- DECL_INITIAL (thunk_fndecl) = make_node (BLOCK);
-
/* Set up cloned argument trees for the thunk. */
t = NULL_TREE;
for (a = DECL_ARGUMENTS (function); a; a = TREE_CHAIN (a))
@@ -424,17 +420,23 @@ use_thunk (tree thunk_fndecl, bool emit_p)
}
a = nreverse (t);
DECL_ARGUMENTS (thunk_fndecl) = a;
- BLOCK_VARS (DECL_INITIAL (thunk_fndecl)) = a;
if (this_adjusting
&& targetm.asm_out.can_output_mi_thunk (thunk_fndecl, fixed_offset,
virtual_value, alias))
{
const char *fnname;
+ tree fn_block;
+
current_function_decl = thunk_fndecl;
DECL_RESULT (thunk_fndecl)
= build_decl (RESULT_DECL, 0, integer_type_node);
fnname = XSTR (XEXP (DECL_RTL (thunk_fndecl), 0), 0);
+ /* The back-end expects DECL_INITIAL to contain a BLOCK, so we
+ create one. */
+ fn_block = make_node (BLOCK);
+ BLOCK_VARS (fn_block) = a;
+ DECL_INITIAL (thunk_fndecl) = fn_block;
init_function_start (thunk_fndecl);
current_function_is_thunk = 1;
assemble_start_function (thunk_fndecl, fnname);