FLANG
|
#include <flang/Lower/StatementContext.h>
Public Types | |
using | CleanupFunction = std::function< void()> |
When lowering a statement, temporaries for intermediate results may be allocated on the heap. A StatementContext enables their deallocation with one of several explicit finalize calls, or with an implicit call to finalizeAndPop() at the end of the context. A context may prohibit temporary allocation. Otherwise, an initial "outer" context scope may have nested context scopes, which must make explicit subscope finalize calls.
In addition to being useful for individual action statement contexts, a StatementContext is also useful for construct blocks delimited by a pair of statements such as (block-stmt, end-block-stmt), or a program unit delimited by a pair of statements such as (subroutine-stmt, end-subroutine- stmt). Attached cleanup code for these contexts may include stack management code, deallocation code, and finalization of derived type entities in the context.