d: Delay removing DECL_EXTERNAL from thunks until funcion has finished
authorIain Buclaw <ibuclaw@gdcproject.org>
Mon, 13 Mar 2023 21:04:24 +0000 (22:04 +0100)
committerIain Buclaw <ibuclaw@gdcproject.org>
Mon, 13 Mar 2023 21:12:21 +0000 (22:12 +0100)
commitd1bddcaf15a362d88c29337295a0aaaaaa037642
tree2812d1af8298348da4245b54faadc5e4fd6a5096
parent499b07700f0e679a490c2e3b80ca7c382dd737ab
d: Delay removing DECL_EXTERNAL from thunks until funcion has finished

Second part to fixing PR109108, don't blindly generate the associated
function definition of all referenced thunks in the compilation. Just
delay finishing a thunk until the function gets codegen itself.  If the
function never gets a definition, then the thunk is left as "extern".

gcc/d/ChangeLog:

* decl.cc (finish_thunk): Unset DECL_EXTERNAL on thunk.
(make_thunk): Set DECL_EXTERNAL on thunk, don't call build_decl_tree.
(finish_function): Call finish_thunk on forward referenced thunks.
gcc/d/decl.cc