Ensure result inputs always have an entry node.

This commit is contained in:
Max Schaefer
2020-09-22 09:08:17 +01:00
parent 4b56581122
commit 2d4f17c91c
2 changed files with 7 additions and 1 deletions

View File

@@ -116,7 +116,7 @@ private class ResultInput extends FunctionInput, TInResult {
|
// if the result is assigned to an SSA variable, we want to propagate mutations backwards
// through that variable
exists(DataFlow::SsaNode ssa | ssa.getInit() = pred | result = ssa.(DataFlow::PostUpdateNode))
exists(DataFlow::SsaNode ssa | ssa.getInit() = pred | result = ssa)
or
// otherwise the entry node is simply the result
not exists(DataFlow::SsaNode ssa | ssa.getInit() = pred) and

View File

@@ -25,9 +25,15 @@
| result | main.go:53:2:53:22 | call to op2 | main.go:53:2:53:22 | call to op2 |
| result | main.go:53:14:53:21 | call to bump | main.go:53:14:53:21 | call to bump |
| result | tst2.go:10:9:10:26 | call to NewEncoder | tst2.go:10:9:10:26 | call to NewEncoder |
| result | tst2.go:10:9:10:39 | call to Encode | tst2.go:10:2:10:4 | definition of err |
| result | tst.go:9:17:9:33 | call to new | tst.go:9:2:9:12 | definition of bytesBuffer |
| result 0 | main.go:51:2:51:14 | call to op | main.go:51:2:51:14 | call to op |
| result 0 | main.go:53:2:53:22 | call to op2 | main.go:53:2:53:22 | call to op2 |
| result 0 | main.go:53:14:53:21 | call to bump | main.go:53:14:53:21 | call to bump |
| result 0 | main.go:54:10:54:15 | call to test | main.go:54:2:54:2 | definition of x |
| result 0 | main.go:56:9:56:15 | call to test2 | main.go:56:2:56:2 | definition of x |
| result 0 | tst2.go:10:9:10:26 | call to NewEncoder | tst2.go:10:9:10:26 | call to NewEncoder |
| result 0 | tst2.go:10:9:10:39 | call to Encode | tst2.go:10:2:10:4 | definition of err |
| result 0 | tst.go:9:17:9:33 | call to new | tst.go:9:2:9:12 | definition of bytesBuffer |
| result 1 | main.go:54:10:54:15 | call to test | main.go:54:5:54:5 | definition of y |
| result 1 | main.go:56:9:56:15 | call to test2 | main.go:56:5:56:5 | definition of y |