Emit forward declarations and definitions of the opaque-array
artificial structs from the C model header (and from the helpers
header). Definitions are gated on a new DefineOpaqueTypes flag
threaded through PTMLHeaderBuilder::printModelHeader so that the
helpers header keeps emitting only the declarations.
* Make the following private headers public:
* Lift/CPUStateAccessAnalysisPass.h
* Lift/CSVOffsets.h
* Lift/PTCDump.h
* Lift/VariableManager.h
* Move from revngSupport to revngLift:
* IRAnnotators.{h,cpp}
* SelfReferencingDbgAnnotationWriter.{h,cpp}
* Move from revngSupport to revngModel:
* FunctionTags.{h,cpp}
* ProgramCounterHandler.{h,cpp}
* Move from revngSupport to revngRecompile:
* OriginalAssemblyAnnotationWriter.{h,cpp}
Because of a sub-par heuristic designed to avoid emitting
*unnecessary* debug information tags, some of the *necessary*
tags were lost as well, leading to debug information mismatch
between the backend and the UI.
Note that this is not a fix, this commit simply removes
the heuristic in question, leading to ~2x increase in
output c file size.
This commit fixes DecompileFunction.cpp to ensure that it can properly
handle calls to helpers that return struct types on LLVM IR.
In the past, these were properly handled but in the current tests this
kind of helpers never reach the C backend anymore.
This is a preliminary change necessary for updating libtcg, where this
kind of helpers will start to appear again.
Instead of failing on decompilation for loops with an empty `Body` which
are not `DoWhile`s (the only admitted type), we emit a warning on the
`c-backend` logger.
Type inlining was a feature that allowed type definitions of
structs/unions/enums to be printed in C directly inside the definition
of another parent struct/union, if the inner type was only used once in
the parent type.
This kind of reasoning is inherently global: a type definition of the
subtype can be inlined in the parent type one only if *globally* the
subtype it isn't referred anywhere else.
This caused issues with type inlining inside definitions of stack types
in the body of functions. Indeed, for a given function, due to type
inlining, it was necessary to do global reasoning about what other types
could be inlined in the definition of the function's stack frame type.
This, in turn, had heavy consequences on invalidation, because any
change to any type (even if it wasn't referred in a given function's
body) was causing invalidation of all functions' bodies.
For this reason it was decided to drop the type inlining feature.
These methods had a misleading name, because they always returned a
ScopeTag, and never indented anything.
As a result they were misused or used in a confusing way in most of
their uses.
They have now both been replaced by two different overloaded methods
with the name getScopeTag.
This commit also fixes all their broken uses.
Because of how name builders used to lazy gather namespaces on the first
requested name, the objects were self mutating. As such only non-const
references could be used to pass them around.
Since that is no longer the case, this restores most of lost const
qualifiers.