Commit Graph

278 Commits

Author SHA1 Message Date
Alessandro Di Federico b91c0f88c6 tmp 2025-09-10 17:59:45 +02:00
Alessandro Di Federico b532b0674a tmp 2025-09-10 13:57:46 +02:00
Tommaso Fontana 680f5cacf2 Apply revng check-conventions --force-format 2025-09-10 12:05:14 +02:00
Ivan Krysak 2b9b925e8c TTG: make doc mandatory in fields too 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 b5337d78da Minor Improvements 2025-07-23 11:38:50 +02:00
Giacomo Vercesi d8ec6b7721 revng.model: add serialize() to all TTG types 2025-07-18 09:30:56 +02:00
Giacomo Vercesi 82dccc0bea revng.tupletree: add TypedListDescriptor
Add a class implementing the descriptor protocol to allow TypedList
fields to be assigned a `list` and automatically convert it to the
TypedList class.
2025-07-18 09:30:56 +02:00
Giacomo Vercesi 0a2cb4df12 TTG: move namespace to the cpp generator
The `namespace` property is strictly used just by the cpp generator.
Move the code so the `--namespace` option is exclusive to it and removed
for all the other generators.
2025-06-25 15:40:13 +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
Giacomo Vercesi d404fee38f Unify TTG CLI tool for generation
Merge all the command-line scripts for generating tuple-tree
implementations into a single `tuple-tree-generate.py` script. Move all
the other files a directory down.
2025-06-25 15:40:13 +02:00
Giacomo Vercesi d53312d867 Rename CppHeadersGenerator to CppGenerator
Since the generator produces more than just headers, rename the class
and the file to just `cpp`.
2025-06-25 15:40:13 +02:00
Giacomo Vercesi 3e3779498e Implement python interface for revng
Add a python interface (`revng.profile`) for interacting with the rev.ng
infrastructure as a whole; either through the CLI (`CLIProject`) or the
GraphQL API (`DaemonProject`).
2025-05-07 10:48:51 +02:00
Giacomo Vercesi de997ca2e4 python TTG: add mixins infrastructure
Add the infrastructure code needed to allow to add mixins to Tuple-Tree
Generated classes in python.
2025-05-07 10:48:50 +02:00
Giacomo Vercesi d8fffc0980 Improve Python's TTG typing
Improve the typing signatures in a few place in the `revng.tupletree`
package and in the auto-generated python TTGs.
2025-05-07 10:48:46 +02:00
Jurij Srebrnič 3050b291b1 Implement diff and apply for python model wrapper
Add the necessary code for the python model wrapper to allow diffing and
applying a diff.
2025-05-07 10:48:45 +02:00
Giacomo Vercesi 9d017ec94d TTG python: change template variable delimiter
Change the variable delimiter for the template used to generate the
tuple-tree wrapper from `'` to `#{` and `}#`.
2025-05-07 10:48:44 +02:00
Giacomo Vercesi 6b7af19817 tuple_tree.ts: rename TypeHints to TypesMetadata
Rename the `TypeHints` to `TypesMetadata` (and related function
arguments) to better convey their contents.
2025-05-07 10:47:27 +02:00
Giacomo Vercesi 57c4f89dd3 python: remove relative imports
Remove all the relative imports from the python code that are not
relative to the current module (e.g. `from .<X> import ...`).
2025-05-05 16:02:40 +02:00
Khaled Ismaeel 8b355fc896 Add primitive support for generating migrations 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 030becfeba Adapt the build to the new schema version field
This is a followup to the commit where we introduced the `version`
field in the schema YAML.
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 531d9b866c Remove the now-redundant HEADERS list 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 63469c9cd6 Use unified YAML schemas in the build process
In this commit we instruct the build system to use the unified schema
files  instead of collecting the `TUPLE-TREE-YAML` comments.

The fixes to C++ files are necessary because they depend on the order
of the fields in the schema, which was changed.
2025-04-30 15:08:45 +02:00
Giacomo Vercesi e7fdd22966 extract-helper-names.sh: fix unquoted variable 2025-04-24 13:22:14 +02:00
Ivan Krysak 80d8ac2b1d Introduce helper list collection 2025-04-17 11:19:17 +03:00
Giacomo Vercesi 140735a913 tuple-tree-generate-typescript: drop --prettier
The `prettier` binary is now assumed to be installed as part of the
system. No need to manually install it and use the `--prettier`
command-line option.
2025-03-13 14:06:02 +01:00
Giacomo Vercesi 6c31138374 Drop unused files in scripts/
Some files under `scripts/` were unused. Delete them as they are no
longer needed.
2025-03-13 14:06:02 +01:00
Giacomo Vercesi 6d0eb467f7 tuple_tree python: implement keying
Implement keying functions for classes that have them.
2025-02-25 09:18:24 +01:00
Alessandro Di Federico 620d142d53 Reroganize and expand documentation 2024-12-11 16:15:37 +01:00
Alessandro Di Federico 0c7c20ad48 Introduce model, artifacts and analyses references 2024-12-11 16:15:27 +01:00
Alessandro Di Federico 276a4aa974 Generate model docs 2024-12-11 16:15:10 +01:00
Ivan Krysak 8a774b22f5 Model: forbid copies and moves of abstract structs 2024-11-06 15:43:13 +02:00
Alessandro Di Federico c1cbb4e9a0 Initialize pointers to nullptr 2024-09-27 12:07:17 +02:00
Ivan Krysak 4a2db0ba4f UpcastablePointer: streamline empty behavior 2024-06-27 11:05:52 +02:00
Ivan Krysak 823e561806 TTG: rework polymorphic serialization
For now, the only serialization trait we were verifying
a polymorphic TTG type to have was the wrong (the one
that only printed base class's fields).

This commit explicitly disables said serializer and
ensures it's never used.

Here's an illustration of the impact of the changes:
```
model::UpcastableType MyType = getTypeFromSomewhere();
model::Type &View = *MyType;
model::PointerType &Pointer = MyType->asPointer();

serialize(MyType); // Good
serialize(Pointer); // Good
serialize(View); // new: explicit error
                 // old: only print base type's fields
```
2024-06-27 11:05:51 +02:00
Ivan Krysak dfa7478685 Adopt reworked model::Type 2024-06-27 11:05:51 +02:00
Ivan Krysak a4f638082d TTG: stop treating GUID as optional 2024-06-27 11:05:50 +02:00
Ivan Krysak a51d755608 TTG: add a static assert on a get miss 2024-06-27 11:05:50 +02:00
Ivan Krysak 806e90a124 TTG: change typescript generator to use comments 2024-06-27 11:05:50 +02:00
Ivan Krysak 9e6bf29f74 TTG: pull dump helper into the template 2024-06-27 11:05:49 +02:00
Ivan Krysak 35444268b3 TTG: strip Kind from the child constructor 2024-06-27 11:05:49 +02:00
Ivan Krysak edb2d11c9a TTG: add upcastable struct field support 2024-06-27 11:05:49 +02:00
Ivan Krysak ee238fd473 RCC: allow prettier to print errors 2024-06-27 11:05:49 +02:00
Ivan Krysak 32fd1eed5b TTG: move classof boilerplate into the template 2024-06-27 11:05:49 +02:00
Ivan Krysak 48ace7c147 TTG: reorder early struct template
This heavily improves readability of the generated header.
2024-06-27 11:05:49 +02:00
Ivan Krysak a85ce02b29 TTG: clean impl.cpp formatting up 2024-06-27 11:05:49 +02:00
Ivan Krysak 37f424da06 TTG: move UpcastableX typedef to the template 2024-06-27 11:05:49 +02:00
Ivan Krysak ce1f13e715 TTG: fix parseClass argument type 2024-06-27 11:05:48 +02:00
Ivan Krysak 93b5ad6067 TTG: add indirect dependencies to root's late.h 2024-06-27 11:05:48 +02:00