Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The new C# declaration-access nodes affect interacting AST, assignable read/write, CFG, SSA/data-flow, and jump-to-definition contracts, requiring broader semantic review than automated approval supports.
No open issues 🎉
What changed in this PR
This PR makes local declaration accesses more consistent across the C# extractor and CodeQL libraries, supporting definition tracking and data-flow analysis without treating declarations as jump-to-definition uses.
Changes:
- Extract defining accesses for uninitialized locals, deconstruction,
foreach, andcatchvariables. - Connect these accesses to assignable definitions and exclude declaration accesses from navigation uses.
- Add focused regression coverage, separate tuple path and inline tests, and update affected baselines.
| File | Description |
|---|---|
csharp/ql/test/library-tests/definitions/PrintAst.expected |
Updates catch and foreach declaration ASTs. |
csharp/ql/test/library-tests/defining-accesses/PrintAst.qlref |
Enables focused AST testing. |
csharp/ql/test/library-tests/defining-accesses/PrintAst.expected |
Records declaration-access AST coverage. |
csharp/ql/test/library-tests/defining-accesses/options |
Configures C# 8 and LINQ support. |
csharp/ql/test/library-tests/defining-accesses/Flow.ql |
Checks source-to-sink data flow. |
csharp/ql/test/library-tests/defining-accesses/Flow.expected |
Records expected declaration-related flows. |
csharp/ql/test/library-tests/defining-accesses/definitions.qlref |
Enables navigation-use testing. |
csharp/ql/test/library-tests/defining-accesses/definitions.expected |
Records uses excluding defining accesses. |
csharp/ql/test/library-tests/defining-accesses/DefiningAccesses.ql |
Checks access targets, classification, and definitions. |
csharp/ql/test/library-tests/defining-accesses/DefiningAccesses.expected |
Records expected defining-access associations. |
csharp/ql/test/library-tests/defining-accesses/DefiningAccesses.cs |
Adds varied declaration and flow fixtures. |
csharp/ql/test/library-tests/dataflow/tuples/TuplesInline.ql |
Separately runs inline flow assertions. |
csharp/ql/test/library-tests/dataflow/tuples/TuplesInline.expected |
Adds an empty inline-failure baseline. |
csharp/ql/test/library-tests/dataflow/tuples/Tuples.ql |
Separates path output from inline assertions. |
csharp/ql/test/library-tests/dataflow/tuples/Tuples.expected |
Updates paths through defining accesses. |
csharp/ql/test/library-tests/dataflow/tuples/PrintAst.expected |
Adds tuple declaration access nodes. |
csharp/ql/test/library-tests/dataflow/tuples/DataFlowStep.expected |
Updates tuple definition flow steps. |
csharp/ql/test/library-tests/dataflow/local/TaintTrackingStep.expected |
Updates a declaration-related taint step. |
csharp/ql/test/library-tests/dataflow/local/DataFlowStep.expected |
Updates a declaration-related flow step. |
csharp/ql/test/library-tests/csharp9/PrintAst.expected |
Updates foreach and deconstruction ASTs. |
csharp/ql/test/library-tests/csharp8/switchexprcontrolflow.expected |
Updates declaration control-flow nodes. |
csharp/ql/test/library-tests/csharp8/PrintAst.expected |
Updates foreach, tuple, and catch ASTs. |
csharp/ql/test/library-tests/csharp7/TaintReaches.expected |
Records taint reaching defining accesses. |
csharp/ql/test/library-tests/csharp7/PrintAst.expected |
Adds defining accesses across declaration forms. |
csharp/ql/test/library-tests/csharp7/LocalTaintFlow.expected |
Updates deconstruction taint-flow steps. |
csharp/ql/test/library-tests/csharp11/PrintAst.expected |
Adds an uninitialized local’s defining access. |
csharp/ql/test/library-tests/controlflow/graph/EntryElement.expected |
Updates declaration entry elements. |
csharp/ql/test/library-tests/controlflow/graph/EnclosingCallable.expected |
Records enclosing callables for new nodes. |
csharp/ql/test/library-tests/controlflow/graph/Condition.expected |
Updates condition relationships for declaration blocks. |
csharp/ql/test/library-tests/controlflow/graph/BasicBlock.expected |
Updates block boundaries and node counts. |
csharp/ql/test/library-tests/assignables/AssignableDefinition.expected |
Adds definition-to-access associations. |
csharp/ql/test/library-tests/assignables/AssignableAccess.expected |
Records new accesses as writes. |
csharp/ql/lib/semmle/code/csharp/Assignable.qll |
Associates local and tuple definitions with accesses. |
csharp/ql/lib/definitions.qll |
Excludes defining accesses from navigation uses. |
csharp/ql/lib/change-notes/2026-11-23-all-local-defining-accesses.md |
Documents expanded defining-access extraction. |
csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/VariableDeclaration.cs |
Creates defining accesses for additional declaration forms. |
csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Query.cs |
Preserves separate range-variable access creation. |
csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/RecursivePattern.cs |
Uses default defining-access creation. |
csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/Pattern.cs |
Updates pattern callers to the revised API. |
Review effort: Balanced (adaptive)
Contributor
hvitved
force-pushed
the
hvitved-all-local-defining-accesses
branch
3 times, most recently
from
November 24, 2026 09:10
ff9c444 to
d0bc5b9
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
hvitved
force-pushed
the
hvitved-all-local-defining-accesses
branch
from
November 24, 2026 15:24
d0bc5b9 to
e57b5f7
Compare
hvitved
marked this pull request as ready for review
November 24, 2026 15:24
This branch has not been deployed
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.
#23183 follow-up; add defining accesses for all local declarations.
DCA has some result changes, but I think much of it is wobble.