Skip to content

Swift: added trapgen #8934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2022
Merged

Swift: added trapgen #8934

merged 1 commit into from
Apr 28, 2022

Conversation

redsun82
Copy link
Contributor

@redsun82 redsun82 commented Apr 28, 2022

This checks in the trapgen script generating trap entries in C++.

The codegen suite has been slightly reorganized, moving the templates
directory up one level and chopping everything into smaller bazel
packages. Running tests is now done via

bazel test //swift/codegen/test

With respect to the PoC, the nested codeql::trap namespace has been
dropped in favour of a Trap prefix (or suffix in case of entries)
within the codeql namespace. Also, generated C++ code is not checked
in in git any more, and generated during build. Finally, labels get
printed in hex in the trap file.

TrapLabel is for the moment only default-constructible, so only one
single label is possible. TrapArena, that is responsible for creating
disjoint labels will come in a later commit, as well as trapgen unit tests.

@redsun82 redsun82 requested review from AlexDenisov and a team April 28, 2022 09:33
@redsun82 redsun82 requested a review from a team as a code owner April 28, 2022 09:33
@github-actions github-actions bot added the Swift label Apr 28, 2022
This checks in the trapgen script generating trap entries in C++.

The codegen suite has been slightly reorganized, moving the templates
directory up one level and chopping everything into smaller bazel
packages. Running tests is now done via
```
bazel run //swift/codegen/test
```

With respect to the PoC, the nested `codeql::trap` namespace has been
dropped in favour of a `Trap` prefix (or suffix in case of entries)
within the `codeql` namespace. Also, generated C++ code is not checked
in in git any more, and generated during build. Finally, labels get
printed in hex in the trap file.

`TrapLabel` is for the moment only default-constructible, so only one
single label is possible. `TrapArena`, that is responsible for creating
disjoint labels will come in a later commit.
Copy link
Contributor

@AlexDenisov AlexDenisov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, LGTM, though suggested command fails:

> bazel run //swift/codegen/test
Starting local Bazel server and connecting to it...
ERROR: Only a single target can be run. Your target pattern //swift/codegen/test expanded to the targets //swift/codegen/test:test_dbscheme, //swift/codegen/test:test_ql, //swift/codegen/test:test_qlgen, //swift/codegen/test:test_render, //swift/codegen/test:test_schema[TRUNCATED]
INFO: Elapsed time: 2.113s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded)
FAILED: Build did NOT complete successfully (1 packages loaded)

@redsun82
Copy link
Contributor Author

Overall, LGTM, though suggested command fails:

> bazel run //swift/codegen/test
Starting local Bazel server and connecting to it...
ERROR: Only a single target can be run. Your target pattern //swift/codegen/test expanded to the targets //swift/codegen/test:test_dbscheme, //swift/codegen/test:test_ql, //swift/codegen/test:test_qlgen, //swift/codegen/test:test_render, //swift/codegen/test:test_schema[TRUNCATED]
INFO: Elapsed time: 2.113s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded)
FAILED: Build did NOT complete successfully (1 packages loaded)

whoops, that is a typo I fixed in the PR description 😅 should have been bazel test

@redsun82 redsun82 merged commit 2374e6b into github:main Apr 28, 2022
@redsun82 redsun82 deleted the swift-trapgen branch April 28, 2022 14:00
@redsun82 redsun82 restored the swift-trapgen branch May 3, 2022 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants