C++: Provide BarrierGuard API without a Unit column when instantiating non-parameterized BarrierGuards#21360
Merged
MathiasVP merged 3 commits intogithub:mainfrom Feb 24, 2026
Merged
Conversation
…ing non-parameterized barrier guards.
Contributor
There was a problem hiding this comment.
Pull request overview
Restores the pre-2.24.2 BarrierGuard / InstructionBarrierGuard non-parameterized API shape (no Unit column) while still delegating internally to the parameterized implementations, fixing a syntactic break introduced in #21185.
Changes:
- Reintroduce non-parameterized
getABarrierNode/0andgetAnIndirectBarrierNode/1wrappers that hide the internalUnitparameter. - Add/adjust API-level documentation for the restored
BarrierGuardwrapper and add wrapper methods forInstructionBarrierGuard.
Comments suppressed due to low confidence (1)
cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll:2679
- In this example the described blocked flow (
x = source()tosink(x)) doesn’t match the code snippet, which assigns to*pand callssink(*p). Updating the text to match the example (or adjusting the example to introducex) would avoid confusion for users.
* will block flow from `x = source()` to `sink(x)`.
*
Contributor
Author
|
DCA was uneventful (as expected) |
ropwareJB
added a commit
to microsoft/codeql
that referenced
this pull request
Feb 24, 2026
C++: Port changes from github#21360
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.
This PR fixes an accidental syntactical breakage I introduced in #21185.
In that PR I added barrier guards via MaD parameters to match the feature in other languages.
As part of that work we needed to support
BarrierGuards parameterize by an arbitrary state column (see this commit). In order to reduce code duplication I then implemented the non-parameterizedBarrierGuardAPI in terms of the parameterizedBarrierGuardAPI with aUnitparameter.However, I forgot that this now meant that you had to specify a
Unitparameter in a couple of places whereas you didn't need to do that before. In particular, before the predicateBarrierGuard<...>::getAnIndirectBarrierNode/1referred to a predicate with an indirection index column, but it now referred to a predicate with aUnitcolumn 🤦 This was detected when Microsoft tried to upgrade to 2.24.2.This PR fixes this by bringing the interface back to the old API. Sadly, this is yet another syntactic breakage, but: