Skip to content

Unified: Add Guards instantiation. - #23350

Draft
aschackmull wants to merge 4 commits into
github:mainfrom
aschackmull:unified/guards
Draft

aschackmull wants to merge 4 commits into
github:mainfrom
aschackmull:unified/guards

Conversation

@aschackmull

Copy link
Copy Markdown
Contributor

No description provided.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The guard analysis can infer false nil states from ordinary null identifiers and conditional casts, and incorrectly transfer checks between parameters with repeated labels.

3 open issues
What changed in this PR

Adds Unified’s integration with the shared guard-analysis library to reason about conditions and the control flow they govern.

Changes:

  • Instantiates guard analysis with Unified expressions, control flow, SSA, and wrapper calls.
  • Adds AST helpers for bitwise operators, compound assignments, and equality tests.
File Description
unified/​ql/​lib/​codeql/​unified/​internal/​controlflow/​Guards.qll Connects Unified to shared guard analysis.
unified/​ql/​lib/​codeql/​unified/​internal/​AstExtra.qll Adds operator classifications used by guard analysis.

Review effort: Balanced (adaptive)

ConstantValue asConstantValue() { none() }
}

private class NullConstant extends ConstantExpr instanceof U::Token {
class NotExpr = U::LogicalNotExpr;

class IdExpr extends Expr {
IdExpr() { this instanceof AssignExpr or this instanceof TypeCastExpr }
(
ppos.asPositional() = result.getPositionalIndex()
or
ppos.asNamed() = result.getExternalName()
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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