Commit Graph

18 Commits

Author SHA1 Message Date
Pietro Fezzardi 81413c4b64 IRASTTypeTranslation: enable floats and bitfields 2021-03-05 16:10:00 +01:00
Pietro Fezzardi 475dc4462c Fix createTypeFromLayout for structs and unions 2021-03-05 16:10:00 +01:00
Pietro Fezzardi ba0e57e956 DeclCreator: unify type mapping 2021-02-02 11:23:53 +01:00
Pietro Fezzardi 3f1ee6ea64 Stub of DLA integration in Clang AST emission 2021-02-02 11:23:53 +01:00
Pietro Fezzardi 9d1d6afe6e MarkForSerialization: extract into its own Pass 2021-02-02 11:23:53 +01:00
Pietro Fezzardi 2ff7044bb9 Decompiler: forward-declare types coming from DLA
This commits enable the emission of rich types associated with function
signatures. This types are forward-declared in the decompiled C code
before the definition of each decompiled function that uses them.

The types we emit for now are the types that the DLA is able to compute
(if any) for the return values and the arguments of the function.

Such types are not yet used in the body of the function, nor in the
function declaration. These are the next steps to come.
2021-02-02 11:23:53 +01:00
Pietro Fezzardi ca999a7c3c Add DeclCreator class to unify forward declaration
Before this commit, the logic to generate all the emitted C forward
declarations (types, global variables, and functions) that has to be
printed before each decompiled function was scattered across three
classes: FuncDeclCreationAction, TypeDeclCreationAction, and
GlobalDeclCreationAction.

These are all gone now, because the scattered logic was very confusing
to follow. Now we only have a single class that takes care of
declarations with global scope: DeclCreator.

Thanks to this, I was able to drop a bunch of useless layers of software
engineering used to shape the creation of the declaration as if it was
some kind of clang ASTConsumer, which is pointless.
2021-02-02 11:23:53 +01:00
Pietro Fezzardi 1e825a8201 Create IRASTTypeTranslator class
This class handles the creation of type declarations in clang's AST, and
holds the relationships between llvm Types and Values with those clang's
type declarations.
2021-02-02 11:23:53 +01:00
Pietro Fezzardi 93d9cbb67b Enforce new include conventions 2020-11-12 18:00:45 +01:00
Alessandro Di Federico 37fde04594 Move licensing details to LICENSE.md 2020-11-09 10:03:33 +01:00
Pietro Fezzardi 87611643ad Fix names of struct types declarations
Before this commit, we assigned names to struct types without looking at
the function names of which they were return types.
Now we do, so that the name of the generated type for the function `f`
is `f_ret_type`.

This also fixes errors when reparsing the generated C code, where the
names of the struct types did not match.
2020-11-03 12:53:11 +01:00
Pietro Fezzardi fc2912ca32 enforce clang-format 2020-01-15 18:24:28 +01:00
Pietro Fezzardi c6c6f19535 Enforce check-conventions 2019-11-20 15:16:17 +01:00
Andrea Gussoni 560a345a2c Enforce -Weverything extensively
Replicate the changes made by this commit
f2a0df309f78e1b5d7c5f81ada5110523644559e perfomed by Pietro on the
branch containing the development fixes for `revng-c`.
2019-11-20 15:16:17 +01:00
Pietro Fezzardi 569ec5658e Add and enforce -Wall and -Werror 2019-11-20 15:16:14 +01:00
Pietro Fezzardi b68f4fd89c Print all types before variable declarations 2019-05-08 17:40:53 +02:00
Pietro Fezzardi 3f7965cf7f Fix emission of global struct types 2019-04-02 16:19:27 +02:00
Pietro Fezzardi 9e4c5f0ece Add support for functions returning structs 2019-04-02 11:57:07 +02:00