Skip to content

Conversation

@kaspersv
Copy link
Contributor

@kaspersv kaspersv commented Jul 10, 2025

Private discard entity predicates are currently marked as dead code by the QL4QL dead code query. This PR updates the query such that discard predicates are always considered alive.

@kaspersv kaspersv force-pushed the kaspersv/ql4ql-discard-entity-preds-alive branch from 8533643 to 1723c6e Compare July 10, 2025 09:09
@kaspersv kaspersv requested a review from nickrolfe July 10, 2025 09:55
@kaspersv kaspersv marked this pull request as ready for review July 10, 2025 09:55
Copilot AI review requested due to automatic review settings July 10, 2025 09:55
@kaspersv kaspersv requested a review from a team as a code owner July 10, 2025 09:55
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 implements support for discard predicates in the dead code analysis for QL4QL. Discard predicates, annotated with overlay[discard_entity], are now recognized as always alive and excluded from dead code detection.

  • Adds AST support for recognizing overlay[discard_entity] annotations
  • Updates the dead code analysis to treat discard predicates as alive
  • Includes test coverage for the new functionality

Reviewed Changes

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

File Description
ql/ql/src/codeql_ql/ast/Ast.qll Adds AST support for parsing overlay[discard_entity] annotations
ql/ql/src/codeql_ql/style/DeadCodeQuery.qll Updates dead code analysis to treat discard predicates as alive
ql/ql/test/queries/style/DeadCode/Foo.qll Adds test case for discard predicate functionality

hvitved
hvitved previously approved these changes Jul 10, 2025
Copy link
Contributor

@nickrolfe nickrolfe left a comment

Choose a reason for hiding this comment

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

Looks sensible.

@kaspersv kaspersv merged commit 767d55b into github:main Jul 10, 2025
12 checks passed
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