C++: Remove support for global variables as sources and sinks in MaD#22089
Open
MathiasVP wants to merge 6 commits into
Open
C++: Remove support for global variables as sources and sinks in MaD#22089MathiasVP wants to merge 6 commits into
MathiasVP wants to merge 6 commits into
Conversation
85eee8c to
0e05ea5
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the (previously partial/undocumented) ability for C/C++ Models-as-Data (MaD) to treat variables (global, namespace, and member variables) as flow sources/sinks, simplifying the MaD interpretation layer ahead of upcoming access-path work.
Changes:
- Drops MaD “variable-as-element” interpretation paths in the C++ MaD implementation.
- Updates the MaD C++ library tests and expected results to remove variable-based source/sink/summary cases.
- Adds a breaking change note documenting the removal.
Show a summary per file
| File | Description |
|---|---|
| cpp/ql/test/library-tests/dataflow/models-as-data/tests.cpp | Removes variable-based MaD source/sink/summary test cases (and related declarations). |
| cpp/ql/test/library-tests/dataflow/models-as-data/testModels.expected | Updates expected interpreted elements to match the removal of variable-based models. |
| cpp/ql/lib/semmle/code/cpp/dataflow/internal/FlowSummaryImpl.qll | Disables MaD input/output interpretation logic for variables. |
| cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll | Removes element-resolution support for member variables and global/namespace variables. |
| cpp/ql/lib/change-notes/2026-06-30-variables-as-mad-sources-and-sinks.md | Documents the breaking removal of variable sources/sinks in MaD. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 3
- Review effort level: Low
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.
When we added MaD support for C/C++ we added (partial) support for picking variables as flow sources or flow sinks. I was never really a fan of adding this kind of support with no clear use-case for it (see my comments here and here) and in the 2 years we've had MaD support we've never had a need for this particular feature, and the only occurrence of this has been in the tests we added 2 years ago. We've also never publicly documented this feature (as it was only ever partially implemented).
I am now adding support for access paths for MaD sources and sinks (because I've got a use-case for it coming up), and this feature variables as sources and sinks are making it harder to support this.
In conclusion: I think we should just remove this feature.
DCA was uneventful (as expected).