18 Commits

Author SHA1 Message Date
Ivan Krysak f9d18cfb9b TTG: remove unnecessary const 2026-06-15 11:47:41 +02:00
Giacomo Vercesi 90e8cce41e 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-10 11:45:12 +02:00
Giacomo Vercesi 704c5e9bbb TupleTree: fix broken operator==
The `operator==` for keyed `StructDefinitions` was the comparison
between keys, which is misleading.
2026-03-04 14:58:02 +01:00
Giacomo Vercesi 27f419c8cd Fix and ban namespace clobbering
Fix an instance where the `std` namespace got clobbered into the global
namespace by accident.
2026-02-16 10:34:38 +01:00
Alessandro Di Federico db8eb227b9 TupleTreePath: rewrite with TraitfulAny 2025-10-28 09:18:27 +01:00
Giacomo Vercesi 46654c8b26 TupleTree: narrow enums to the smallest uint
When emitting `EnumDefinition`s in C++, use the smallest uint type as
the base class.
2025-10-15 11:58:40 +02:00
Ivan Krysak 2d618120e0 TTG: add default: value support
This also unifies `get_default_value` helper across all the target
languages.

Before this, there were two different versions of it for python
and typescript while c++ side didn't have one at all.
2025-10-13 18:33:10 +03:00
Ivan Krysak 75e505b2ec TTG: do not print an unnecessary comment
`Tracking helpers` comment would be printed even if invalidation is
disabled for a given TTG instance.
2025-10-13 18:33:10 +03:00
Ivan Krysak da7623acb0 TTG: introduce a simple isValid helper for enums
It checks whether value is within the valid range:
```
Invalid < Value < Count
```
2025-10-13 18:33:10 +03:00
Ivan Krysak cc57e57fd1 TTG: remove support for optional: true fields
After this commit, every non-key field is treated as if it was optional
while every key field (plus every auto-generated `Kind` field) - as if
it was required.
2025-10-13 18:33:10 +03:00
Ivan Krysak 59ffacf61b localCompare: mention fields as they are skipped 2025-10-13 18:33:10 +03:00
Ivan Krysak 2315248938 TTG: remove a broken KOT-compatibility check 2025-10-13 18:33:10 +03:00
Ivan Krysak 89282f31da Minor improvements 2025-10-13 18:33:10 +03:00
Giacomo Vercesi c68b7f1ab6 TupleTreeGenerator: make all keys hashable
Make all `Key` structs generated by TupleTreeGenerator have a
`std::hash` specicialization.
2025-09-17 14:02:40 +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 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