@@ -448,32 +448,23 @@ module GoCfg {
448448 }
449449
450450 predicate postOrInOrder ( Ast:: AstNode n ) {
451+ // Leaf value expressions: these have no CFG children, so the shared
452+ // library's default (which only makes expressions *with* children
453+ // post-order) would otherwise treat them as simple leaf nodes with no
454+ // in-order value node.
451455 n instanceof Go:: ReferenceExpr
452456 or
453457 n instanceof Go:: BasicLit
454458 or
455459 n instanceof Go:: FuncLit
456460 or
457- n instanceof Go:: CallExpr and
458- not n = any ( Go:: DeferStmt defer ) .getCall ( ) and
459- not n = any ( Go:: GoStmt go_ ) .getCall ( )
460- or
461- n instanceof Go:: BinaryExpr and not n instanceof Go:: LogicalBinaryExpr
462- or
463- n instanceof Go:: UnaryExpr and not n instanceof Go:: NotExpr
464- or
465- n instanceof Go:: ConversionExpr
466- or
467- n instanceof Go:: TypeAssertExpr
468- or
469- n instanceof Go:: IndexExpr
470- or
471- n instanceof Go:: SliceExpr
472- or
461+ // An empty composite literal (e.g. `T{}`) has no CFG children, so it too
462+ // needs an explicit in-order (allocation) node.
473463 n instanceof Go:: CompositeLit
474464 or
475- n instanceof Go:: ReturnStmt
476- or
465+ // Statements/declarations that compute a value or perform an operation and
466+ // are not among the statements the shared library makes post-order by
467+ // default.
477468 n instanceof Go:: DeferStmt
478469 or
479470 n instanceof Go:: GoStmt
@@ -485,9 +476,6 @@ module GoCfg {
485476 n instanceof Go:: IncDecStmt
486477 or
487478 n instanceof Go:: FuncDecl
488- or
489- n instanceof Go:: SelectorExpr and
490- n .( Go:: SelectorExpr ) .getBase ( ) instanceof Go:: ValueExpr
491479 }
492480
493481 predicate additionalNode ( Ast:: AstNode n , string tag , NormalSuccessor t ) {
@@ -1272,7 +1260,14 @@ module GoCfg {
12721260 * would be unreachable and pruned, breaking data flow through `f(g())`.
12731261 */
12741262 private predicate callExprStep ( PreControlFlowNode n1 , PreControlFlowNode n2 ) {
1275- exists ( Go:: CallExpr call | postOrInOrder ( call ) and extractNodeCondition ( call , _) |
1263+ exists ( Go:: CallExpr call |
1264+ // Restrict to ordinary invoked calls; the calls of `defer`/`go`
1265+ // statements are evaluated in place but invoked later / concurrently,
1266+ // and are handled by `deferStmt`/`goStmtStep` instead.
1267+ not call = any ( Go:: DeferStmt s ) .getCall ( ) and
1268+ not call = any ( Go:: GoStmt s ) .getCall ( ) and
1269+ extractNodeCondition ( call , _)
1270+ |
12761271 // Route through the callee and the (single) inner-call argument
12771272 childSequenceStep ( call , n1 , n2 )
12781273 or
0 commit comments