Commit Graph

25 Commits

Author SHA1 Message Date
Pietro Fezzardi ba923a90fa Move Mangling.h in Support 2022-01-11 15:41:20 +01:00
Pietro Fezzardi 80f1e2fd6d Explictly convert llvm::StringRef to std::string
Implicit conversion is not available anymore in llvm-12.
2021-05-27 17:14:25 +02:00
Pietro Fezzardi e34426c03e Decompiler: handle PHINode with StructType 2021-05-06 10:37:56 +02:00
Pietro Fezzardi 36a525314a Detect isolated functions using FunctionTags 2021-04-27 21:19:06 +02:00
Pietro Fezzardi e95c21db25 Use Model to detect isolated functions 2021-02-23 10:39:05 +01:00
Pietro Fezzardi 42b9fb97e7 Drop static storage specifier for globals 2021-02-02 11:23:53 +01:00
Pietro Fezzardi ba0e57e956 DeclCreator: unify type mapping 2021-02-02 11:23:53 +01:00
Pietro Fezzardi 821b430f40 Collapse FunctionDecls map into GlobalDecls map 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 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 cbbbdf660f [DLA] propagate DLA results to CDecompilerPass 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 37f43f7e83 Use Value names for C declarations if possible
With this commit, the declarations of local variables and function
parameters now use the name of the associated `llvm::Value` if present,
instead of always using the prefix "param_" or "var_".
2020-11-02 12:32:22 +01:00
Pietro Fezzardi fc98fc69f5 Fix detection of isolated functions using metadata 2020-07-22 17:27:02 +02: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
Andrea Gussoni 11298108ff Handle variadic functions in decompilation
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.
2019-06-13 12:10:38 +00:00
Pietro Fezzardi b68f4fd89c Print all types before variable declarations 2019-05-08 17:40:53 +02:00
Pietro Fezzardi 9e4c5f0ece Add support for functions returning structs 2019-04-02 11:57:07 +02:00
Pietro Fezzardi 6e710dede1 Remove unused variable 2019-03-29 11:17:21 +01:00
Pietro Fezzardi 2640bbfeeb Use uniform naming for decompiler source files 2019-03-11 18:11:05 +01:00