Skip to content
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

Convert shared CFG construction library to a parameterized module #13509

Merged
merged 6 commits into from
Aug 3, 2023

Conversation

hvitved
Copy link
Contributor

@hvitved hvitved commented Jun 20, 2023

This PR converts the existing ControlFlowGraphImplShared.qll to a parameterized module, and puts it into a new controlflow QL pack (where, eventually, we can also put stuff like basic blocks and guards). In this PR, only Ruby is adopting the new shared library; I plan to do C# follow-up, and perhaps Swift (unless @github/codeql-swift beats me to it).

Whitespace-insensitive commit-by-commit review is suggested.

The PR makes use of extends inside parameterized modules, which is only publicly supported in 2.14.0 (expected to be released July 11th), so cannot be merged until then (this is the reason why the CI check Compile all queries using the latest stable CodeQL CLI currently fails). 2.14.0 has now been released, so this PR is safe to merge.

@hvitved hvitved force-pushed the cfg-pack branch 3 times, most recently from 5067515 to 37d9875 Compare June 27, 2023 13:59
@hvitved hvitved marked this pull request as ready for review June 27, 2023 14:27
@hvitved hvitved requested a review from a team as a code owner June 27, 2023 14:27
@hvitved hvitved requested review from MathiasVP and aibaars July 3, 2023 08:31
Copy link
Contributor

@aibaars aibaars left a comment

Choose a reason for hiding this comment

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

Generally looks good to me. I wonder if we can get rid of most uses of AstNode. Also don't forget to include the new library in the list of things to release in the build file.

shared/controlflow/codeql/controlflow/Cfg.qll Outdated Show resolved Hide resolved
shared/controlflow/codeql/controlflow/Cfg.qll Show resolved Hide resolved
* For more information about locations see [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
*/
signature class LocationSig {
/** Gets the 1-based line number (inclusive) where this location starts. */
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess you "forgot" getFile on purpose, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, because that would require a File class in scope.

Copy link
Contributor

@MathiasVP MathiasVP left a comment

Choose a reason for hiding this comment

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

LGTM once DCA comes back happy 🤞!

@hvitved hvitved merged commit e011480 into github:main Aug 3, 2023
25 checks passed
@hvitved hvitved deleted the cfg-pack branch August 3, 2023 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants