Skip to content

Bound.qll - Replace utility for range analysis duplicate across java and cs with shared file#21900

Open
BazookaMusic wants to merge 9 commits into
mainfrom
bazookamusic/range-analysis-bound-move-to-shared
Open

Bound.qll - Replace utility for range analysis duplicate across java and cs with shared file#21900
BazookaMusic wants to merge 9 commits into
mainfrom
bazookamusic/range-analysis-bound-move-to-shared

Conversation

@BazookaMusic
Copy link
Copy Markdown

We have this doc of identical files across languages: https://github.com/github/codeql/blob/main/config/identical-files.json

As an exercise, I created a shared library and removed the duplication between CS and Java.

@BazookaMusic BazookaMusic marked this pull request as ready for review June 1, 2026 16:10
Copilot AI review requested due to automatic review settings June 1, 2026 16:10
@BazookaMusic BazookaMusic requested review from a team as code owners June 1, 2026 16:10
Copy link
Copy Markdown
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 reduces Java/C# duplication in range analysis by introducing a shared Bound library under codeql/rangeanalysis and switching the language-specific libraries to instantiate it via per-language definition modules.

Changes:

  • Added shared/rangeanalysis/codeql/rangeanalysis/Bound.qll as the shared implementation.
  • Updated Java and C# bound libraries to use the shared implementation via BoundSpecific::BoundDefs.
  • Updated packaging/config to support the new shared dependency and removed the now-obsolete “identical files” entry.
Show a summary per file
File Description
shared/rangeanalysis/codeql/rangeanalysis/Bound.qll Introduces shared bound abstractions and a parameterized Bound module.
java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/BoundSpecific.qll Defines Java bindings (BoundDefs) implementing the shared bound signature.
java/ql/lib/semmle/code/java/dataflow/Bound.qll Replaces the Java-specific bound implementation with an instantiation of the shared module.
csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/BoundSpecific.qll Defines C# bindings (BoundDefs) implementing the shared bound signature.
csharp/ql/lib/semmle/code/csharp/dataflow/Bound.qll Replaces the C#-specific bound implementation with an instantiation of the shared module.
csharp/ql/lib/qlpack.yml Adds the codeql/rangeanalysis dependency required by the new shared import.
config/identical-files.json Removes the Java/C# “Bound” identical-files entry since the code is now shared.

Copilot's findings

  • Files reviewed: 7/7 changed files
  • Comments generated: 2

predicate interestingExprBound(Expr e);
}

/** Provides classes for representing abstract bounds for use in, for example, range analysis. */
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