d: Defer compiling inline definitions until after the module has finished.
commit8db5b71e212debcc4f6a17f80191ca187c307fcb
authorIain Buclaw <ibuclaw@gdcproject.org>
Mon, 15 Aug 2022 17:00:43 +0000 (15 19:00 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Mon, 15 Aug 2022 19:35:10 +0000 (15 21:35 +0200)
tree19dedca9ea02beaa0587e37b8b5f5301ca061361
parente206fecaac29f559f4990312b875604eb1ce3ef3
d: Defer compiling inline definitions until after the module has finished.

This is to prevent the case of when generating the methods of a struct
type, we don't accidentally emit an inline function that references it,
as the outer struct itself would still be incomplete.

gcc/d/ChangeLog:

* d-tree.h (d_defer_declaration): Declare.
* decl.cc (function_needs_inline_definition_p): Defer checking
DECL_UNINLINABLE and DECL_DECLARED_INLINE_P.
(maybe_build_decl_tree): Call d_defer_declaration instead of
build_decl_tree.
* modules.cc (deferred_inline_declarations): New variable.
(build_module_tree): Set deferred_inline_declarations and a handle
declarations pushed to it.
(d_defer_declaration): New function.
gcc/d/d-tree.h
gcc/d/decl.cc
gcc/d/modules.cc