Skip to content

Conversation

@hvitved
Copy link
Contributor

@hvitved hvitved commented Jun 10, 2025

No description provided.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Jun 10, 2025
@hvitved hvitved marked this pull request as ready for review June 10, 2025 14:30
Copilot AI review requested due to automatic review settings June 10, 2025 14:30
@hvitved hvitved requested a review from a team as a code owner June 10, 2025 14:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors various QL modules to use the new helper predicates (getParam, getArg, getAParam, getAnArg) in place of manually traversing ParamList and ArgList.

  • Replace calls like getParamList().getParam(n) with getParam(n) (and getArgList().getArg(n) with getArg(n)).
  • Swap getParamList().getAParam() for getAParam() and getArgList().getAnArg() for getAnArg().
  • Simplify parameterExactAccess and related call sites to use these helpers.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
CaptureModels.qll Use c.getParam(...) helper instead of c.getParamList().getParam.
TypeInference.qll Switch to getParam(0) and getArg(0) helpers for type and args.
Type.qll Use function.getAParam() rather than function.getParamList().getAParam().
VariableImpl.qll Simplify parameter pattern checks via getAParam().
CallExprImpl.qll Replace getArgList().getArg(...) with getArg(...).
ControlFlowGraphImpl.qll Use getParam(i-1) instead of getParamList().getParam(i-1).
CfgNodes.qll Swap getArgList().getAnArg() for getAnArg().

not exists(Function f | not f.hasBody() and f.getAParam().getPat() = pat) and
// exclude parameters from function pointer types (e.g. `x` in `fn(x: i32) -> i32`)
not exists(FnPtrTypeRepr fp | fp.getParamList().getParam(_).getPat() = pat)
not exists(FnPtrTypeRepr fp | fp.getParamList().getAParam().getPat() = pat)
Copy link

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

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

[nitpick] For consistency with other modules, call fp.getAParam() directly instead of via getParamList(). This matches how Function.getAParam() is used above.

Suggested change
not exists(FnPtrTypeRepr fp | fp.getParamList().getAParam().getPat() = pat)
not exists(FnPtrTypeRepr fp | fp.getAParam().getPat() = pat)

Copilot uses AI. Check for mistakes.
@hvitved hvitved requested review from a team and redsun82 June 10, 2025 16:48
@hvitved hvitved merged commit 64ab7c7 into github:main Jun 10, 2025
16 checks passed
@hvitved hvitved deleted the rust/use-get-arg-param branch June 10, 2025 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants