Commit Graph

124 Commits

Author SHA1 Message Date
Paolo Tranquilli
8f93f5e34b Rust: move to Label<T> and mark unsafety of from_untyped 2024-09-13 17:17:19 +02:00
Paolo Tranquilli
faf1eeeb0d Rust: introduce typed labels 2024-09-13 13:57:14 +02:00
Paolo Tranquilli
beb27bf5e3 Rust: fix QL compilation and schema includes ordering 2024-09-12 15:05:30 +02:00
Paolo Tranquilli
573b8b9373 Merge branch 'rust-experiment' into redsun82/rust-ci 2024-09-09 12:32:02 +02:00
Paolo Tranquilli
56e127849f Rust/Codegen: fix generated list files 2024-09-09 12:31:09 +02:00
Paolo Tranquilli
10a23c0843 Merge branch 'rust-experiment' into redsun82/rust-doctest-gen 2024-09-09 12:20:55 +02:00
Paolo Tranquilli
ee2a8b09f6 Rust: fix formatting 2024-09-09 12:11:50 +02:00
Paolo Tranquilli
3cd8aaf4b0 Rust: simplify rust doc test annotation 2024-09-09 08:59:17 +02:00
Arthur Baars
c8f73587cc Rust: codegen: fix generated code 2024-09-07 10:32:59 +02:00
Paolo Tranquilli
928f3f11f1 Rust: remove <> from function wrapper 2024-09-06 14:34:12 +02:00
Paolo Tranquilli
8c5cc2efdc Rust: generate test code from schema docstrings
This generates test source files from code blocks in class docstrings.

By default the test code is generated as is, but it can optionally:
* be wrapped in a function providing an adequate context using
  `@rust.doc_test_function(name, *, lifetimes=(), return_type="()", **kwargs)`,
  with `kwargs` providing both generic and normal params depending on
  capitalization
* be skipped altogether using `@rust.skip_doc_test`

So for example an annotation like
```python
@rust.doc_test_function("foo",
                        lifetimes=("a",),
                        T="Eq",
                        x="&'a T",
                        y="&'a T",
                        return_type="&'a T")
```
will result in the following wrapper:
```rust
fn foo<'a, T: Eq>(x: &'a T, y: &'a T) -> &'a T {
    // example code here
}
```
2024-09-06 14:24:42 +02:00
Paolo Tranquilli
7e1290aa74 Rust: reuse shared rust trap library 2024-08-30 16:08:37 +02:00
Paolo Tranquilli
4f0fe1ce3a Rust: bazel packaging 2024-08-30 13:05:46 +02:00
Paolo Tranquilli
590a146b49 Rust: some basic extraction of function names (with locations!) 2024-08-29 17:58:50 +02:00
Paolo Tranquilli
f40901f391 Rust: archiving + skeleton def translator 2024-08-28 17:15:49 +02:00
Paolo Tranquilli
2606d3f6d1 Reapply "Bazel: add codeql specific packaging library"
This reverts commit 31d6b9be4d.
2024-05-29 15:46:29 +02:00
Paolo Tranquilli
31d6b9be4d Revert "Bazel: add codeql specific packaging library" 2024-05-29 15:27:10 +02:00
Paolo Tranquilli
6bbad22672 Codegen: make codegen work on windows 2024-05-27 16:05:38 +02:00
Paolo Tranquilli
9f5782b67b Bazel: introduce buildifier formatting
This introduces tooling and enforcement for formatting bazel files.

The tooling is provided as a bazel run target from
[keith/buildifier-prebuilt](https://github.com/keith/buildifier-prebuilt).

This is used in a [`pre-commit`](https://pre-commit.com/) hook for those
having that installed. In turn this is used in a CI check. Relying on a
`pre-commit` action gives us easy checking that buildifying did not
change anything in the files and printing the diff, without having to
hand-roll the check ourselves.

This enforcement will make usage of gazelle easier, as gazelle itself
might reformat files, even outside of `go`. Having them properly
formatted will allow gazelle to leave them unchanged, without needing
to configure awkward exclude directives.
2024-04-24 15:49:48 +02:00
Paolo Tranquilli
19bb8fe22d Bazel: use bzlmod 2024-02-12 10:55:40 +01:00
Paolo Tranquilli
0b57ecf0c7 Codegen: add internal QLdoc to property templates 2023-11-24 06:56:55 +01:00
Paolo Tranquilli
2d34fec0a2 Codegen: remove unneeded has_description property 2023-11-24 06:56:55 +01:00
Paolo Tranquilli
9264b2a6d6 Codegen: add internal to properties, rename ql_internal->internal 2023-11-24 06:56:55 +01:00
Paolo Tranquilli
a18f1ef7cd Codegen: fix bug where stub rewriting globbles too much code 2023-11-23 17:14:32 +01:00
Paolo Tranquilli
ff529c34b4 Codegen: use re.escape 2023-11-23 09:37:44 +01:00
Paolo Tranquilli
369431125e Codegen: insert doc explaining _patch_class_qldoc 2023-11-22 10:26:04 +01:00
Paolo Tranquilli
f5633be837 Codegen: rename has_doc to has_qldoc 2023-11-22 10:19:36 +01:00
Paolo Tranquilli
418118fc89 Codegen: use more robust regex to patch qldocs 2023-11-22 10:11:05 +01:00
Paolo Tranquilli
30161b0f12 Codegen: patch customized stubs with QLdoc 2023-11-21 17:51:27 +01:00
Paolo Tranquilli
d659709695 Codegen: add render_str 2023-11-21 17:28:12 +01:00
Paolo Tranquilli
e40c53a340 Swift: add full docs to stub classes 2023-11-21 17:27:30 +01:00
Paolo Tranquilli
b4fd95bd6a Swift: move stub QLdocs to separate templates 2023-11-21 16:25:21 +01:00
Paolo Tranquilli
5b724a7aaf Swift: add QLdoc for Generated modules 2023-11-21 16:18:28 +01:00
Paolo Tranquilli
dcb2117b31 Swift: tweak generated doc comments 2023-11-09 12:12:07 +01:00
Paolo Tranquilli
ac838d72de Codegen: mark all generated files and classes as INTERNAL 2023-11-08 10:02:17 +01:00
Paolo Tranquilli
b7543f5dc7 Codegen: pass ql_internal to Stub 2023-11-08 09:54:21 +01:00
Paolo Tranquilli
10afa4381a Swift: add more doc strings to generated things 2023-11-07 16:29:03 +01:00
Paolo Tranquilli
02a2debe94 Codegen: fix python compatibility problem 2023-10-23 16:56:44 +02:00
Paolo Tranquilli
7cc20587ad Codegen: add @qltest.test_with
This allows to group together related AST classes to reuse the same
test source and extraction. For example this is useful for
`EnumDecl/EnumCaseDecl/EnumElementDecl`, where this is applied to.
2023-10-23 14:51:22 +02:00
Paolo Tranquilli
60b7d79fba Revert "Revert "Swift: use C++20 constraints and concepts to simplify code"" 2023-09-21 10:17:22 +02:00
Paolo Tranquilli
1daedd9fb6 Revert "Swift: use C++20 constraints and concepts to simplify code" 2023-08-21 17:40:15 +02:00
Paolo Tranquilli
7c764f3b50 Swift: use C++20 constraints and concepts to simplify code
This simplifies several instances of metaprogramming by leveraging
[constraints and concepts from C++20][1]. This:
* gets rid of `std::enable_if` by usage of `requires`, making it more
  readable and yield better compiler messages.
* uses `requires` instead of `static_assert` to enforce `TrapLabel`
  typing
* simplifies all compile-time tests for validity of a given expression
* uses some standard library concepts where possible
* generalizes and simplifies `SwiftLocationExtractor`

Notice that in order to use the `std::derived_from` concept, `virtual`
inheritance had to be added to the label tags, because diamond
inheritance is a problem otherwise. That's because
`std::derived_from<T, U>` requires that `T*` be convertible to `U*`,
which is false if there are multiple non-virtual inheritance paths from
`U` to `T`. As tags never get actually instantiated, there is no runtime
performance penalty in using `virtual` inheritance.

[1]: https://en.cppreference.com/w/cpp/language/constraints
2023-08-17 17:24:42 +02:00
Paolo Tranquilli
700e3d5e53 Codegen: rename ipa to synth 2023-06-07 09:12:39 +02:00
Nora Dimitrijević
2529312d1d Codegen: fix test.qlgen failure 2023-06-06 15:58:19 +02:00
Nora Dimitrijević
928da77d10 Merge branch 'main' into redsun82/swift-synth-properties 2023-06-06 15:34:02 +02:00
Paolo Tranquilli
cc271d682e Codegen: ignore synth properties in cppgen 2023-05-25 16:05:25 +02:00
Paolo Tranquilli
b09386a2c8 Codegen: ignore synth properties in Raw.qll 2023-05-25 16:05:12 +02:00
Paolo Tranquilli
00fb796f3b Codegen: ignore synth properties in dbschemegen 2023-05-25 16:05:12 +02:00
Paolo Tranquilli
d2c9847a79 Codegen: parse synth property modifier 2023-05-25 16:05:12 +02:00
Paolo Tranquilli
165ac3eeaa Codegen: define and propagate synth property flag 2023-05-25 16:05:12 +02:00