Before this commit, when GlobalDeclCreationAction needed to emit
literals for initialization of global variables, it did it using
custom code.
This was not working properly, an in some cases it emitted short
literals which are not allowed in C.
Hence the generated C code that was impossible to recompile without
syntax errors.
This commit fixes this problem, using the getLiteralFromConstant method
of StmtBuilder.
In order to do this, we need to make the StmtBuilder available inside
the GlobalDeclCreationAction, which is not a very clean design.
However, we are already planning to merge the GlobalDeclCreationAction
and the StmtBuilder class, so this issue will be taken care of in the
future.
Replicate the changes made by this commit
f2a0df309f78e1b5d7c5f81ada5110523644559e perfomed by Pietro on the
branch containing the development fixes for `revng-c`.
Handle `InsertValue` instructions which provide a `ConstantStruct` as
initialization.
A new value declaration at the top of the function is emitted and later
used as initilization for the struct which is being populated.
Handle the emission of variadic functions (such as the
`indirect_handler` helper function) both in regards if declaration and
definition.
Handle also `undef` values in calls to the `indirect_handler` function.