Commit Graph

39 Commits

Author SHA1 Message Date
Giacomo Vercesi b229fcc469 model: rework python mixin infrastructure
Rework the python mixin infrastructure for the model. Mixins are now
specified explicitly instead of using the `ast` module. The mixins are
loaded relative to the generated python file, this allows to have two
models: `revng.model` and `revng.project.model`. The latter is augmented
via mixins to have project-specific facilities such as `get_artifact`
and artifact accessors.
2026-04-09 17:07:44 +02:00
Ivan Krysak 754cfd57fe Model: introduce migration to version 9 2026-03-27 08:19:21 +00:00
Giacomo Vercesi ce60d8a1e5 pypeline: integrate model migration infrastructure
When calling `Model.deserialize` the model will be automatically be
migrated if it needs to.
2026-03-05 14:23:06 +01:00
Lauri Vasama aa2597d13b model::Function: add stack frame name and comment
* StackFrameType() is removed.
* StackFrame() is introduced in its place.
* Use StackFrame().Type() to acess the stack frame type.
2026-02-13 08:41:39 +02:00
Giacomo Vercesi 40da49548b Add Binaries list to the model
Add to the model an entry detailing the list of input binaries under
`Binaries`. This will be referenced by `Segments` when needed.
2025-10-16 17:48:45 +02:00
Giacomo Vercesi f17aa20bd7 model.migrations: implicitly increase version
Instead of delegating to the migration the task of increasing the model
version, do it implicitly as part of the `migrate` function.
2025-10-16 16:08:05 +02:00
Lauri Vasama 653d451e6c Remove undef name configuration support
Also adds a model migration removing
Configuration.Naming.UndefinedValuePrefix.
2025-09-29 18:05:55 +03:00
Ivan Krysak 461c49df25 Model: bump version to 5 and introduce migration 2025-07-23 11:38:52 +02:00
Giacomo Vercesi fb21b4aef3 revng.tupletree: drop enum_value_to_index
Drop the `enum_value_to_index` function, as it is unused in the entire
codebase.
2025-07-18 09:30:56 +02:00
Giacomo Vercesi d8ec6b7721 revng.model: add serialize() to all TTG types 2025-07-18 09:30:56 +02:00
Giacomo Vercesi 38b50c2977 tupletree: fix Reference class
Fix the `Reference` class, make it work with the new model and allow it
to be dereferences via the `_accessor` attribute.
2025-07-18 09:30:55 +02:00
Giacomo Vercesi 8065ebf634 Add revng.model.TypeId
Add a class that allows indexing `model.TypeDefinitions` with a single
object.
2025-07-18 09:30:55 +02:00
Giacomo Vercesi 460ffbf965 project: move some methods to Binary
Move some methods from the `Project` class to `model.Binary`.
2025-07-18 09:30:55 +02:00
Ivan Krysak 0d868894a2 model::Function: switch to indices as comment keys 2025-05-08 15:42:00 +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
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 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 9d80594ddc Bump model version to v3 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 9b07b3bcce Add primitive migration support to the CLI 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 7156cace7b Drop multiversion support in Python model wrapper 2025-04-30 15:08:45 +02:00
Ivan Krysak dfa7478685 Adopt reworked model::Type 2024-06-27 11:05:51 +02:00
Ivan Krysak ac587cbb4f Model: rename Type into TypeDefinition 2024-06-27 11:05:48 +02:00
Giacomo Vercesi 90ea42b695 model/_util.py: move into tupletree.py
Move the contents of `model/_util.py` into `tupletree.py` as it's
model-agnostic and used by all generated Python tuple-tree wrappers.
2023-09-14 15:44:32 +02:00
Alessandro Di Federico 247879f7fc model::Type::ID: switch to progressive IDs
This commit switches `model::Type::ID` from being a GUID to be a
progressive number, in order to make things easier for humans.

On top of this, this commit introduces the following changes:

* TypeCopier: import all the necessary PrimitiveTypes and improve
  handling of CustomName.
* Move Kind as the last field of the key of each TupleTree type used in
  an `UpcastablePointer`.
* Update the ground truth of tests to ignore the `CustomName` in favor
  of focusing on `OriginalName`.
* Increase adoption of `model::Binary::makeType`, equivalent to
  `Binary.recordNewType(makeType<model::*Type>())`.
2023-08-23 16:14:04 +02:00
Giacomo Vercesi 3a006422d3 typescript/python model wrappers: fix structure
Change the way the python and typescript model wrappers handle
attributes in struct fields. Now all fields are populated and none of
the use `None`.
2023-07-21 09:34:00 +02:00
Giacomo Vercesi 152a624f47 revng.model: drop last version autodetection
revng.model.__init__ would dynamically import the latest version of
the model when imported, however this would break IDE hints as the
classes would not be properly detected. Instead we now manually
specify the last version in the __init__.py file.
2022-07-22 15:07:14 +02:00
Giacomo Vercesi 116d965117 revng.model: implement kw_only
Implement a constructor override for model classes that checks that the
constructor does not have positional arguments passed to it. This can
be dropped post-3.10 since it is implemented natively by kw_only.
2022-07-22 14:56:15 +02:00
Giacomo Vercesi 2329201ba1 revng.model: import contents of MetaAddress
This allows to have all the classes needed for model manipulation to
be available with `from revng.model import *`.
2022-07-22 14:56:15 +02:00
Giacomo Vercesi 018518d783 revng.model: remove tags from dumper
Tags in the yaml have been deprecated for a while, remove them from
being outputted from YAML dumper.
2022-07-22 14:56:15 +02:00
Giacomo Vercesi bbce0b33e5 revng-check-conventions: introduce isort 2022-04-20 09:57:08 +02:00
Giacomo Vercesi 46821cee5f revng-check-conventions: introduce mypy 2022-04-20 09:57:01 +02:00
Giacomo Vercesi 31a836e48c revng-check-conventions: introduce flake8 2022-04-20 09:56:44 +02:00
Giacomo Vercesi d81dc49809 revng-check-conventions: license check 2022-04-20 09:55:18 +02:00
Giacomo Vercesi a2b5dbb1dc TupleTreeGenerator: autogenerate Kind 2022-04-08 17:36:59 +02:00
Giacomo Vercesi 039f7db93e model::*: ensure Kind -> Class correspondence 2022-04-08 17:31:05 +02:00
Filippo Cremonese 70a460c46a TupleTreeGenerator: use dataclasses
Give up on pydantic.
2022-03-22 17:52:02 +01:00
Alessandro Di Federico 9608b337c6 Python formatting: switch to black 22 2022-03-02 15:40:27 +01:00
Filippo Cremonese 7f7a222410 python-model: handle importing multiple versions 2022-02-23 18:03:36 +01:00
Filippo Cremonese 09a995ba51 python-model: generate from jsonschema 2022-02-23 18:03:35 +01:00