Skip to content

Commit a20c8cf

Browse files
committed
Add post-update nodes for implicit field read nodes
1 parent dcfa721 commit a20c8cf

File tree

7 files changed

+5
-117
lines changed

7 files changed

+5
-117
lines changed

go/ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,11 @@ module Public {
838838
exists(IR::MethodReadInstruction mri |
839839
ce.getTarget() instanceof Method and
840840
mri = IR::evalExprInstruction(ce.getCalleeExpr()) and
841-
insn = mri.getReceiver()
841+
// If a.x is reading a promoted field, and it's equivalent to a.b.c.x,
842+
// then mri.getReceiver() will give us the implicit field read a.b.c
843+
// and we want to have post-update nodes for a, the implicit field
844+
// read a.b and the implicit field read a.b.c.
845+
insn = IR::lookThroughImplicitFieldRead*(mri.getReceiver())
842846
)
843847
) and
844848
mutableType(insn.getResultType())
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
reverseRead
2-
| pkg1/embedding.go:56:29:56:39 | implicit dereference | Origin of readStep is missing a PostUpdateNode. |
3-
| pkg1/embedding.go:57:33:57:46 | implicit dereference | Origin of readStep is missing a PostUpdateNode. |
4-
| pkg1/embedding.go:58:14:58:22 | implicit read of field embedder | Origin of readStep is missing a PostUpdateNode. |
5-
| pkg1/embedding.go:58:31:58:42 | implicit read of field embedder | Origin of readStep is missing a PostUpdateNode. |
62
| pkg1/tst.go:43:6:43:6 | t | Origin of readStep is missing a PostUpdateNode. |
73
| pkg1/tst.go:46:6:46:6 | t | Origin of readStep is missing a PostUpdateNode. |
8-
| pkg1/tst.go:50:2:50:2 | t | Origin of readStep is missing a PostUpdateNode. |
94
| pkg1/tst.go:53:6:53:7 | t2 | Origin of readStep is missing a PostUpdateNode. |
105
| pkg1/tst.go:55:6:55:7 | t2 | Origin of readStep is missing a PostUpdateNode. |
11-
| promoted.go:18:6:18:6 | t | Origin of readStep is missing a PostUpdateNode. |

go/ql/test/library-tests/semmle/go/dataflow/ExternalFlowInheritance/CONSISTENCY/DataFlowConsistency.expected

Lines changed: 0 additions & 37 deletions
This file was deleted.

go/ql/test/library-tests/semmle/go/dataflow/PromotedMethods/CONSISTENCY/DataFlowConsistency.expected

Lines changed: 0 additions & 7 deletions
This file was deleted.

go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/CONSISTENCY/DataFlowConsistency.expected

Lines changed: 0 additions & 20 deletions
This file was deleted.

go/ql/test/library-tests/semmle/go/frameworks/Macaron/CONSISTENCY/DataFlowConsistency.expected

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)