[DwarfCompileUnit] Set parent DIE right after creating a local entity
No functional changes intended. Before this patch DwarfCompileUnit::createScopeChildrenDIE() and DwarfCompileUnit::createAndAddScopeChildrenDIE() used to emit child subtrees and then when all the children get created, attach them to a parent scope DIE. However, when a DIE doesn't have a parent, all the requests for its unit DIE fail. Currently, this is not a big issue since it isn't usually needed to know unit DIE for a local (function-scoped) entity. But once we introduce lexical blocks as a valid scope for global variables (static locals) and type DIEs, any requests for a unit DIE need to be guarded against local scope due to the potential absence of the DIE's parent. To avoid the aforementioned issue, this patch refactors a few DwarfCompileUnit methods to support the idea of attaching a DIE to its parent as close to the creation of this DIE as possible. Reviewed By: ellis Differential Revision: https://reviews.llvm.org/D114350
Loading
Please sign in to comment