300 Commits

Author SHA1 Message Date
Massimo Fioravanti 742e1a0c56 TupleTree: switch from public fields to accessors 2022-12-12 18:36:57 +01:00
Alessandro Di Federico 5fb9ba4313 TupleTree diff: externalize 2022-12-09 10:11:27 +01:00
Alessandro Di Federico daf4a85364 llvm::yaml::yamlize: externalize 2022-12-09 10:11:27 +01:00
Alessandro Di Federico 0245bf81d7 stringAsPath: externalize 2022-12-09 10:11:27 +01:00
Alessandro Di Federico a96270a8aa TupleTree::visit: externalize 2022-12-09 10:11:27 +01:00
Alessandro Di Federico 22c1ec78eb TupleTree: handle type-erased visitors
This commit reduces build times by introducing a type-erasure layer when
performing a visit on TupleTrees. Basically instead of propagating the
type of the visitor along all of the template castle, we wrap the
visitor into a virtual class with one method for each possible type in
the TupleTree.
This enables a single instatiation of visit algorithm.
2022-12-09 09:10:39 +01:00
Alessandro Di Federico bffbd58434 tuple_tree_generator: generate one .cpp only 2022-12-09 09:07:06 +01:00
Alessandro Di Federico 5feea4e47a Drop graphlib-backport: we require Python 3.10 2022-10-11 19:08:10 +02:00
Alessandro Di Federico 6fae9fc1c5 Stop checking Python requirements 2022-10-11 19:08:10 +02:00
Giacomo Vercesi bf4122ed0a Introduce v2 of revng-check-conventions 2022-09-29 15:21:59 +02:00
Alessandro Di Federico 52755aa4b4 TTG: fix temporary file leak in TypeScript backend 2022-09-26 18:09:01 +02:00
Giacomo Vercesi ae5522e861 tuple_tree_generator: minor TypeScript fixes 2022-09-02 03:49:54 +02:00
Alessandro Di Federico 1d91ed9beb tuple_tree_generator: make C++ just a regular backend
The `tuple_tree_generator` component was still heavily treating C++ as a
special citizen.
This commit normalizes the situation.
2022-08-11 16:20:42 +02:00
Alessandro Di Federico 6f93a7503f tuple_tree_generator: more informative errors 2022-08-08 13:55:25 +02:00
Ivan Krysak 65d1a016d4 Standardize concept naming across the codebase 2022-08-05 17:27:56 +03:00
Giacomo Vercesi b18dc3ac86 TypeScript: add toString to string types 2022-07-28 08:48:16 +02:00
Giacomo Vercesi cc8c6ea203 TupleTree: add ScalarTraits for non-composite keys
Non-composite keys are single-element tuples, therefore they don't
directly inherit the YAML serialization of their only element.

This commit enables building `ScalarTraits` for keys in all cases.
2022-07-28 08:44:57 +02:00
Giacomo Vercesi 4486167d92 revng.model: add TypedList
Add a specialized list class to be used in the model. This will do
runtime instance checking to make sure that list-like fields in the
model only contain object of the correct type.
2022-07-22 14:56:15 +02:00
Giacomo Vercesi cac78b9604 revng.model: fix required sequence fields
Fix the constructor for required sequence fields, now they use a
`default_factory` with `list` to construct an empty list when none is
passed to the constructor.
2022-07-22 14:56:15 +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 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 a741e39f76 revng-check-conventions: introduce prettier
Adds the formatting tool prettier to allow formatting JS, TS, JSON,
YAML and HTML files.
2022-06-28 15:29:09 +02:00
Alessandro Di Federico f4684e244d Switch to new testsuite 2022-06-20 19:04:18 +02:00
Pietro Fezzardi a17a456479 revng-check-conventions: fix clang-format errors
Before this commit, clang-format somw clang format errors were
discarded.
This commit fixes the problems, in two ways:
- passes -Werror to clang-format, to make it stricter when reporting
  errors
- drops a wrong || true when `--force-format` is passed resulting in bad
  error codes
2022-05-11 09:29:45 +02:00
Pietro Fezzardi 17b4129350 revng-check-conventions: better detect SCRIPT_PATH
The new detection mechanism works across symlinks, while the previous
did not.
2022-05-11 09:29:45 +02:00
Alessandro Di Federico 450b0b4013 Minor changes 2022-05-11 09:29:45 +02:00
Giacomo Vercesi a4ca82b50b Introduce TypeScript model generator 2022-05-09 13:37:35 +02:00
Giacomo Vercesi a98a7bb5d5 tuple_tree_generator: python_type -> type_info
This is part of an effort to generalize our current generator to make it
easier to support multiple backends.
2022-05-09 13:35:59 +02:00
Giacomo Vercesi b3535d8092 revng-check-conventions: isort improvements
* Make isort ignore default `src_paths`
* Improve sorting rules in case of missing modules
2022-05-09 13:33:46 +02:00
Giacomo Vercesi 316e5f1ff7 revng-check-conventions: refactor run_revng_checks
Split `run_revng_checks` into C/C++ specific tests and general tests.
2022-05-09 13:33:18 +02:00
Alessandro Di Federico 422d5d88e4 Minor changes
Apply fixes due to `isort` misconfiguration.
2022-05-09 13:32:07 +02:00
Giacomo Vercesi 23362444b8 check-conventions: improve file list generation
Improves the generation of the file list by using git diff-files and
parsing the output directly.

Also:

* The list now only includes files that exist in the working directory
  (so no existence checks are needed).
* Added `--cached` option to check staged files only.
* Fix some missing local variable declarations.
2022-04-28 09:46:10 +02:00
Giacomo Vercesi 7c64831835 revng-check-conventions: install configurations
Fix bug in revng-check-conventions that caused config files to not
be present in the install directory and to not be looked for if run
from there.
2022-04-28 09:45:52 +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 daa3388389 Add commit range option to revng-check-conventions
This commit also introduces `--HEAD` which is useful for `git rebase -x`
checks.
2022-04-20 09:56:06 +02:00
Giacomo Vercesi 8758c7fcc3 Print header for run_revng_checks 2022-04-20 09:55:41 +02:00
Giacomo Vercesi d81dc49809 revng-check-conventions: license check 2022-04-20 09:55:18 +02:00
Giacomo Vercesi 52a5c700e1 revng-check-conventions: add shellcheck
Add bash script checks with shellcheck + `set` rule.
Also, all existing bash scripts have been fixed.
2022-04-20 09:54:51 +02:00
Giacomo Vercesi 56b004bfd2 Improve revng-check-conventions
* Only check dirty files by default (--all checks all files).
* Better file identification
* Various bash improvements
* Report more explicative errors
2022-04-20 09:53:19 +02:00
Massimo Fioravanti 44720eedbd Redesign TupleTreeDiff
`TupleTreeDiff` is now type-safe and owns the changes.
2022-04-15 15:14:13 +02:00
Giacomo Vercesi a2b5dbb1dc TupleTreeGenerator: autogenerate Kind 2022-04-08 17:36:59 +02:00
Giacomo Vercesi 457d782ea8 UpcastablePointer::YAMLTraits: use Kind 2022-04-08 17:32:12 +02:00
Ivan Krysak 326624f517 Fix TupleTreeCompatible linkage problem
Now all the generated `.cpp` include `Binary.h`. This ensures we don't
trigger the wrong concept due to forward declarations.

Also, this commit introduces a couple of `static_assert`s which should
enable us to early identification of similar problems.
2022-03-28 15:33:30 +02:00
Filippo Cremonese 70a460c46a TupleTreeGenerator: use dataclasses
Give up on pydantic.
2022-03-22 17:52:02 +01:00
Alessandro Di Federico 2b55d1df22 Adopt cmake-format 2022-03-17 18:52:18 +01:00
Alessandro Di Federico da7701bd4e Move all executables except revng to libexec/revng
We used to collect all binaries into the `bin/` directory. However this
led to confusions since certain commands where available both as
`revng-command` and `revng command`.

This commit moves all the executables except `revng` into
`libexec/revng`, which, according to FHS, is dedicated to "internal
binaries that are not intended to be executed directly by users or shell
scripts".
2022-03-17 14:10:50 +01:00
Alessandro Di Federico 69cd0db81f tuple_tree_generator: make Key strongly typed 2022-03-08 12:25:47 +01:00
Alvise de Faveri 9e326682bc Check-conventions: handle dirs with 0 python files 2022-03-02 15:40:27 +01:00