Commit Graph

6 Commits

Author SHA1 Message Date
Paolo Tranquilli
0b9dc9703f Swift: changes required for TBD node rework
These changes are required to allow a new type-safe approach to TBD
nodes, that will come in a separate commit.

This introduces:
* the possibility to add properties to the root `Element`
* a functor taking tags to the corresponding binding trap entry
* `hasProp()` methods for optional properties in QL
* `getPrimaryQlClass()` method
2022-05-10 11:59:25 +02:00
Paolo Tranquilli
c08e6fdc1e Swift codegen: add predicate properties
Properties marked with `predicate` in the schema are now accepted.

* in the dbscheme, they will translate to a table with a single `id`
  column (and the table name will not be pluralized)
* in C++ classes, they will translate to `bool` fields
* in QL classes, they will translate to predicates

Closes https://github.com/github/codeql-c-team/issues/1016
2022-05-09 17:50:49 +02:00
Paolo Tranquilli
9798d8ba26 Swift: add ?* modifier to schema specification
This indicates a list of optional entries. This is different than
simply repeatind entries because of the indexing.
2022-05-05 11:50:12 +02:00
Paolo Tranquilli
d5d1eb717d Swift: add structured C++ generated classes
This adds `cppgen`, creating structured C++ classes mirroring QL classes
out of `schema.yml`.

An example of generated code at the time of this commit can be found
[in this gist][1].

[1]: https://gist.github.com/redsun82/57304ddb487a8aa40eaa0caa695048fa

Closes https://github.com/github/codeql-c-team/issues/863
2022-05-04 18:20:25 +02:00
Paolo Tranquilli
7f0476049f Swift: removed spurious mock import 2022-04-27 09:11:14 +02:00
Paolo Tranquilli
f171ce6341 Swift: add unit tests to code generation
Tests can be run with
```
bazel test //swift/codegen:tests
```

Coverage can be checked installing `pytest-cov` and running
```
pytest --cov=swift/codegen swift/codegen/test
```
2022-04-27 08:24:11 +02:00