Skip to content

Swift: switch to shared, parameterized CFG library #15219

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

Conversation

rdmarsh2
Copy link
Contributor

@rdmarsh2 rdmarsh2 commented Jan 3, 2024

No description provided.

@rdmarsh2 rdmarsh2 requested a review from a team as a code owner January 3, 2024 21:35
@github-actions github-actions bot added the Swift label Jan 3, 2024
Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

Looks good, but there are some odds and ends to finish:

  • needs a change note and autoformat.
  • fix for the CfgConsistency tests (it looks like they're trying to import an old file).
  • plus see my two comments above below.
  • then a DCA run to check for regressions / build confidence.

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.

This LGTM! I think we should merge the new ControlFlowGraphParameter.qll file into ControlFlowGraphImplSpecific.qll, but otherwise I think the only real thing we need here is a DCA run!

---
category: minorAnalysis
---
* The control flow graph library (`codeql.swift.controlflow`) has been transitioned to use the shared implementation from the `codeql/controlflow` qlpack. No result changes are expected due to this change.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I would have put a change note here (since no users are expected to notice this change), but I guess it doesn't hurt 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, that's my fault - I asked for a change note because the check was failing, without thinking about whether should have just added the flag to say that one is not required. I agree it doesn't do any harm.

@@ -1,3 +1,252 @@
#-----| ... = ...
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome! Are these changes all from a9c9170?

@rdmarsh2 rdmarsh2 requested a review from a team as a code owner January 9, 2024 20:03
@github-actions github-actions bot added the C++ label Jan 9, 2024
@rdmarsh2 rdmarsh2 force-pushed the rdmarsh2/swift/parameterized-cfg-library branch from bf31913 to ec6d8da Compare January 9, 2024 20:04
@github-actions github-actions bot removed the C++ label Jan 9, 2024
predicate scopeFirst(CfgScope scope, ControlFlowElement first) {
scope.(Impl::CfgScope::Range_).entry(first)
}
/** Gets the maximum number of splits allowed for a given node. */

Check warning

Code scanning / CodeQL

Class QLDoc style.

The QLDoc for a class should start with 'A', 'An', or 'The'.
@geoffw0
Copy link
Contributor

geoffw0 commented Jan 16, 2024

Changes LGTM and I think the DCA run LGTM as well (no result changes, analysis time possibly a speedup). Though I am slightly worried by the join-order badness (v1) result for signalapp__Signal-iOS - does anyone have an intuition as to whether that's concerning?

@rdmarsh2
Copy link
Contributor Author

That does look like a bad join order that's worth investigating, but it doesn't look like it's actually new - the tuple sum went up by 7802, but the max tuple count for a row is 17186585 both before and after.

@MathiasVP
Copy link
Contributor

Indeed, running this with --tuple-counting has revealed a couple of bad join orders, but (as Robert says) this isn't related to this PR. The m# in the name (m#Pattern::Pattern.getMatchingExpr) probably implies that this is bad magic, and that we should add a pragma[nomagic] to Pattern.getMatchingExpr. But let's just do this as a follow-up.

@MathiasVP MathiasVP merged commit 1fba345 into github:main Jan 16, 2024
@MathiasVP
Copy link
Contributor

This fixes the join: #15348

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