Commit Graph

370 Commits

Author SHA1 Message Date
Giacomo Vercesi c2afb05049 VerifyHelper: set ReasonBuffer with simple str
When using `maybeFail(bool, llvm::Twine)` the `ReasonBuffer` variable
was not being set, leading sometimes to the verify reason being an empty
string.
2025-09-09 12:27:33 +02:00
Giacomo Vercesi eba55456f6 NameBuilder: fix a use-after-free bug 2025-09-08 16:33:51 +02:00
Ivan Krysak c80309088a NameBuilder: add shouldUseAutomaticName method
It provides a way to dynamically check whether a custom name is
going to be emitted for a specific entity or not.
2025-09-04 16:57:16 +03:00
Ivan Krysak 2b9b925e8c TTG: make doc mandatory in fields too 2025-07-23 11:38:52 +02:00
Ivan Krysak 9589721b52 Model schema: reorder and reformat
This improves readability and navigation in this big file.
2025-07-23 11:38:52 +02:00
Ivan Krysak f49ec25de3 TTG: make doc mandatory in structs and enums 2025-07-23 11:38:52 +02:00
Ivan Krysak a11215bd73 Model schema: drop trailing newlines from docs 2025-07-23 11:38:52 +02:00
Ivan Krysak 461c49df25 Model: bump version to 5 and introduce migration 2025-07-23 11:38:52 +02:00
Ivan Krysak c9072ec28f TypePathHelpers: add variable and goto label paths 2025-07-23 11:38:52 +02:00
Ivan Krysak 0572de8990 TypePathHelpers: fix incorrect return value paths 2025-07-23 11:38:52 +02:00
Ivan Krysak 21734cad34 CTypeBuilder: add new variable and label tagging 2025-07-23 11:38:51 +02:00
Ivan Krysak 4265644adf NameBuilder: introduce counting sub-builders 2025-07-23 11:38:51 +02:00
Ivan Krysak 554ffa376a model::Function: introduce GotoLabels field 2025-07-23 11:38:51 +02:00
Ivan Krysak 1ebeb8f493 model::Function: introduce LocalVariables field 2025-07-23 11:38:50 +02:00
Ivan Krysak 4e3c6cccd0 Model: introduce LocalIdentifier struct 2025-07-23 11:38:50 +02:00
Ivan Krysak b982ae68d0 NamingConfiguration: add UnnamedGotoLabelPrefix 2025-07-23 11:38:50 +02:00
Giacomo Vercesi d62b7b6b1a TTG: inline root type in schema
Move the root type inside the schema definition, as it is a property of
it and not of the generator.
2025-06-25 15:40:13 +02:00
Lauri Vasama a7eb86174b Add revng/Support/Identifier.h for id validation 2025-06-04 15:13:47 +02:00
Pietro Fezzardi 0426c773b2 CABIFunctionDefinition: drop array argument/return
This commit bans from the model array types in as argument or return
types in CABIFunctionDefinition.
CABIFunctionDefinition implies we're decompiling towards C, and C does
not support array arguments (passed by copy) nor array return types.

Banning these from the model reduces the number of situations where we
have to emit artificial array wrappers (not present in the model) around
types when printing C code, simplifying the handling of such situations
when translating to clift and in general in the decompilation pipeline.
2025-05-28 17:11:11 +02:00
Pietro Fezzardi b106024a13 NameBuilder: fix artificialArrayWrapperNameImpl
This commit fixes a copy-paste error that unfortunately did not lead to
compilation errors, but caused null pointer dereference every time the
method was called with a model::PointerType or model::PrimitiveType
argument.
2025-05-14 10:15:14 +02:00
Pietro Fezzardi 76c63ae5b7 CommonTypeMethods: add getArrayElement 2025-05-14 10:12:03 +02:00
Ivan Krysak 17a5d19135 NameBuilder: add name overload for primitives 2025-05-08 15:42:00 +02:00
Ivan Krysak 0d868894a2 model::Function: switch to indices as comment keys 2025-05-08 15:42:00 +02:00
Khaled Ismaeel 9d80594ddc Bump model version to v3 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 383af5b6b0 Add the version field to schemas YAML
Here we start restructuring the the schemas YAML such that it
contains a top-level `version` field. In this commit we only modify
the YAML, the build system changes will come later, to avoid
enormous commits.
2025-04-30 15:08:45 +02:00
Khaled Ismaeel 53a5ff07cf Remove embedded TUPLE-TREE-YAML 2025-04-30 15:08:45 +02:00
Khaled Ismaeel f384b10435 Check schemas into the codebase
These schema files are currently generated at build time by
collecting various TUPLE-TREE-YAML comments using the
`extract_yaml.py` script. In this commit we move them to the codebase
but we don't use them yet, this will be done at a later commit for
the sake of readability.
2025-04-30 15:08:40 +02:00
Ivan Krysak 1622bb91a1 Introduce automatic names for dynamic functions 2025-04-24 13:22:14 +02:00
Ivan Krysak 79964eac74 Avoid ' misuse in error messages and comments 2025-04-17 16:41:21 +02:00
Ivan Krysak 83324fcf07 NameBuilder: improve documentation 2025-04-17 11:19:17 +03:00
Ivan Krysak 76ed261375 Use revng_undefined_ instead of init_
Current `init_` prefix used to set the default values of SCVs
is very common in typical code, hence it would cause a lot of
collisions.
2025-04-17 11:19:17 +03:00
Ivan Krysak c6e38cd485 Return to using constant name builders
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.
2025-04-17 11:19:17 +03:00
Ivan Krysak 6a6b34b831 Introduce a general static registry helper 2025-04-17 11:19:17 +03:00
Ivan Krysak 57b5eb7f98 NameBuilder: allow different name checkers 2025-04-17 11:19:17 +03:00
Ivan Krysak acb7d595ef Model: introduce a primitive typedef removal pass 2025-04-17 11:19:17 +03:00
Ivan Krysak c9ade8d458 NameBuilder: report reason when renaming something 2025-04-17 11:19:17 +03:00
Ivan Krysak cf78106d54 Model: introduce a name deduplication pass 2025-04-17 11:19:17 +03:00
Ivan Krysak dce5c1a02c NamingConfiguration: pull more prefixes inside
Unify additional values that used to be hardcoded in the old backend
under the same naming configuration root.
2025-04-17 11:19:17 +03:00
Ivan Krysak af79a289d8 NamingConfiguration: add a new option
It's `ReserveNamesStartingWithUnderscore`.
2025-04-17 11:19:17 +03:00
Ivan Krysak 57ac85d7a0 NameBuilder: introduce warning method 2025-04-17 11:19:17 +03:00
Ivan Krysak f070f1f1e1 Model: sunset double name system 2025-04-17 11:19:17 +03:00
Ivan Krysak 25790b5a78 NameBuilder: change automatic segment name
Use index within the binary instead of address in order to make these
shorter.
2025-04-15 16:35:42 +03:00
Ivan Krysak 645cf7fc2e NameBuilder: sunset deduplication
This reworks NameBuilder to ease the transition to the system where
the model will be guaranteed to never contain any name collisions, both
between user-specified names and the automatic ones.
2025-04-15 16:35:42 +03:00
Ivan Krysak 45cc80cb68 PrimitiveType: introduce isCName helper 2025-04-15 16:35:42 +03:00
Ivan Krysak cbddbaa462 Model: add a way to iterate over all the registers 2025-04-15 16:35:42 +03:00
Ivan Krysak e10199ee1c TypeDefinitionKind: introduce a prefix consumer 2025-04-15 16:35:42 +03:00
Ivan Krysak 6ea75f02b3 Model: switch to the new namespace verifier 2025-04-15 16:35:42 +03:00
Ivan Krysak 6710dacfed Model: give path helpers a home 2025-04-15 16:35:42 +03:00
Ivan Krysak 3edb6cbb9b Minor improvements 2025-04-15 16:35:42 +03:00
Ivan Krysak 705e4a5955 auto [...] -> auto &&[...] 2025-02-13 13:10:51 +02:00