Guards: Generalise ValidationWrapper to support GuardValue-based BarrierGuards#21001
Merged
aschackmull merged 4 commits intogithub:mainfrom Dec 10, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR generalizes the ValidationWrapper module in the Guards library to support GuardValue-based barrier guards and renames related components to better reflect their general parameter usage rather than being constrained to flow-state.
- Changes the
guardChecksSigsignature from acceptingboolean branchto acceptingGuardValue gv - Renames
StateSigtoParamSig,WithStatetoWithParam, andValidationWrapperWithStatetoParameterizedValidationWrapper - Updates Java and C++ implementations to adapt to the new GuardValue-based interface
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| shared/controlflow/codeql/controlflow/Guards.qll | Generalizes validation wrapper signatures to use GuardValue instead of boolean, and renames state-related identifiers to more general parameter naming |
| java/ql/lib/semmle/code/java/dataflow/internal/SsaImpl.qll | Adds adaptation layer to convert from boolean-based guard checks to GuardValue-based interface |
| cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaImpl.qll | Updates module references and adds adaptation layer for GuardValue-based interface |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
af8f4e8 to
7d8e2d6
Compare
hvitved
reviewed
Dec 10, 2025
Contributor
hvitved
left a comment
There was a problem hiding this comment.
LGTM, but could we have a test case?
Contributor
|
Also, remember to run DCA. |
fd4a503 to
eaa9686
Compare
hvitved
approved these changes
Dec 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First commit as the title says - in particular, this allows BarrierGuards that work like assertions, i.e. they potentially throw instead of returning a boolean.
Second commit renames the module as the WithState naming felt a bit too constrained - it's not just (flow-)state, it's a general parameter that can be used for whatever.