File tree Expand file tree Collapse file tree
test/library-tests/semmle/go/controlflow/ControlFlowGraph Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,6 +106,14 @@ module CfgImpl {
106106 not skipCfg ( n ) and
107107 result = n .getChild ( index )
108108 or
109+ exists ( Go:: Assignment assgn , Go:: Expr lhs |
110+ n = assgn and lhs = assgn .getLhs ( _) and lhs = n .getChild ( index ) and skipCfg ( lhs )
111+ |
112+ result = lhs .( Go:: StarExpr ) .getBase ( )
113+ or
114+ result = lhs .( Go:: DerefExpr ) .getOperand ( )
115+ )
116+ or
109117 // The body block of a switch (expression or type) is transparent (see
110118 // `skipCfg`), so it is not itself a child and contributes no children.
111119 // Expose the case clauses directly as children of the switch instead,
Original file line number Diff line number Diff line change @@ -772,6 +772,8 @@ module Public {
772772 private IR:: Instruction getADirectlyWrittenInsn ( ) {
773773 exists ( Write w | w .writesComponentInstruction ( result , _) )
774774 or
775+ result = any ( Write w ) .getLhs ( ) .( IR:: PointerTarget ) .getBase ( )
776+ or
775777 result = IR:: evalExprInstruction ( any ( SendStmt s ) .getChannel ( ) )
776778 }
777779
Original file line number Diff line number Diff line change 27762776| stmts3.go:14:13:14:13 | x | stmts3.go:14:21:16:1 | block statement |
27772777| stmts3.go:14:21:16:1 | After block statement | stmts3.go:14:1:16:1 | Normal Exit |
27782778| stmts3.go:14:21:16:1 | block statement | stmts3.go:15:2:15:8 | ... = ... |
2779- | stmts3.go:15:2:15:8 | ... = ... | stmts3.go:15:7 :15:8 | Before 42 |
2779+ | stmts3.go:15:2:15:8 | ... = ... | stmts3.go:15:3 :15:3 | Before x |
27802780| stmts3.go:15:2:15:8 | After ... = ... | stmts3.go:14:21:16:1 | After block statement |
27812781| stmts3.go:15:2:15:8 | assign:0 ... = ... | stmts3.go:15:2:15:8 | After ... = ... |
2782+ | stmts3.go:15:3:15:3 | After x | stmts3.go:15:7:15:8 | Before 42 |
2783+ | stmts3.go:15:3:15:3 | Before x | stmts3.go:15:3:15:3 | x |
2784+ | stmts3.go:15:3:15:3 | x | stmts3.go:15:3:15:3 | After x |
27822785| stmts3.go:15:7:15:8 | 42 | stmts3.go:15:7:15:8 | After 42 |
27832786| stmts3.go:15:7:15:8 | After 42 | stmts3.go:15:2:15:8 | assign:0 ... = ... |
27842787| stmts3.go:15:7:15:8 | Before 42 | stmts3.go:15:7:15:8 | 42 |
You can’t perform that action at this time.
0 commit comments