d: Refactor DECL_ARGUMENT and DECL_RESULT generation to own function
commit499b07700f0e679a490c2e3b80ca7c382dd737ab
authorIain Buclaw <ibuclaw@gdcproject.org>
Sun, 12 Mar 2023 20:43:31 +0000 (12 21:43 +0100)
committerIain Buclaw <ibuclaw@gdcproject.org>
Mon, 13 Mar 2023 20:57:03 +0000 (13 21:57 +0100)
treee7c4275262cf9c28ee167e917ebf00b0a949fddd
parent6360bf9a2d08f08c151464c77c0da53cd702ff25
d: Refactor DECL_ARGUMENT and DECL_RESULT generation to own function

When looking into PR109108, the reason why things go awry is because
of the logic around functions with thunks - they have their definitions
generated even when they are external.  This subsequently then relied on
the detection of whether a function receiving codegen really is extern
or not, and this check ultimately prunes too much.

This is a first step to both removing the call to `build_decl_tree' from
`make_thunk' and the pruning of symbols within the `build_decl_tree'
visitor method for functions.  Move the generation of DECL_ARGUMENT and
DECL_RESULT out of `build_decl_tree' and into their own functions.

gcc/d/ChangeLog:

* decl.cc (get_fndecl_result): New function.
(get_fndecl_arguments): New function.
(DeclVisitor::visit (FuncDeclaration *)): Adjust to call
get_fndecl_arguments.
(make_thunk): Adjust to call get_fndecl_arguments and
get_fndecl_result.
(start_function): Adjust to call get_fndecl_result.
gcc/d/decl.cc