@@ -76,6 +76,8 @@ module SsaFlow {
7676 or
7777 result .( Impl:: ExprNode ) .getExpr ( ) = n .asStmt ( )
7878 or
79+ result .( Impl:: ExprNode ) .getExpr ( ) = n .( ProcessNode ) .getProcessBlock ( )
80+ or
7981 result .( Impl:: ExprPostUpdateNode ) .getExpr ( ) = n .( PostUpdateNode ) .getPreUpdateNode ( ) .asExpr ( )
8082 or
8183 n = toParameterNode ( result .( Impl:: ParameterNode ) .getParameter ( ) )
@@ -148,7 +150,8 @@ private module Cached {
148150 } or
149151 TPreReturnNodeImpl ( CfgNodes:: AstCfgNode n , Boolean isArray ) { isReturned ( n ) } or
150152 TImplicitWrapNode ( CfgNodes:: AstCfgNode n , Boolean shouldWrap ) { isReturned ( n ) } or
151- TReturnNodeImpl ( CfgScope scope )
153+ TReturnNodeImpl ( CfgScope scope ) or
154+ TProcessNode ( ProcessBlock process )
152155
153156 cached
154157 Location getLocation ( NodeImpl n ) { result = n .getLocationImpl ( ) }
@@ -462,6 +465,9 @@ private module ParameterNodes {
462465 p .getName ( ) = ns .getAName ( )
463466 )
464467 )
468+ or
469+ parameter .isPipeline ( ) and
470+ pos .isPipeline ( )
465471 )
466472 }
467473
@@ -508,6 +514,26 @@ module ArgumentNodes {
508514 )
509515 }
510516 }
517+
518+ private predicate isPipelineInput (
519+ CfgNodes:: StmtNodes:: CmdBaseCfgNode input , CfgNodes:: StmtNodes:: CmdBaseCfgNode consumer
520+ ) {
521+ exists ( CfgNodes:: StmtNodes:: PipelineCfgNode pipeline , int i |
522+ input = pipeline .getComponent ( i ) and
523+ consumer = pipeline .getComponent ( i + 1 )
524+ )
525+ }
526+
527+ class PipelineArgumentNode extends ArgumentNode , StmtNode {
528+ CfgNodes:: StmtNodes:: CmdBaseCfgNode consumer ;
529+
530+ PipelineArgumentNode ( ) { isPipelineInput ( this .getStmtNode ( ) , consumer ) }
531+
532+ override predicate argumentOf ( DataFlowCall call , ArgumentPosition pos ) {
533+ call .asCall ( ) = consumer and
534+ pos .isPipeline ( )
535+ }
536+ }
511537}
512538
513539import ArgumentNodes
@@ -706,6 +732,12 @@ predicate readStep(Node node1, ContentSet c, Node node2) {
706732 node2 = TImplicitWrapNode ( cfgNode , true ) and
707733 c .isSingleton ( any ( Content:: KnownElementContent ec ) )
708734 )
735+ or
736+ c .isAnyElement ( ) and
737+ exists ( SsaImpl:: DefinitionExt def |
738+ node1 .( ProcessNode ) .getIteratorVariable ( ) = def .getSourceVariable ( ) and
739+ SsaImpl:: firstRead ( def , node2 .asExpr ( ) )
740+ )
709741}
710742
711743/**
@@ -731,6 +763,9 @@ predicate expectsContent(Node n, ContentSet c) {
731763 or
732764 n = TImplicitWrapNode ( _, false ) and
733765 c .isSingleton ( any ( Content:: UnknownElementContent ec ) )
766+ or
767+ n instanceof ProcessNode and
768+ c .isAnyElement ( )
734769}
735770
736771class DataFlowType extends TDataFlowType {
@@ -850,6 +885,24 @@ private class ReturnNodeImpl extends TReturnNodeImpl, NodeImpl {
850885 override predicate nodeIsHidden ( ) { any ( ) }
851886}
852887
888+ private class ProcessNode extends TProcessNode , NodeImpl {
889+ ProcessBlock process ;
890+
891+ ProcessNode ( ) { this = TProcessNode ( process ) }
892+
893+ override CfgScope getCfgScope ( ) { result = process .getEnclosingScope ( ) }
894+
895+ override Location getLocationImpl ( ) { result = process .getLocation ( ) }
896+
897+ override string toStringImpl ( ) { result = process .toString ( ) }
898+
899+ override predicate nodeIsHidden ( ) { any ( ) }
900+
901+ PipelineIteratorVariable getIteratorVariable ( ) { result .getProcessBlock ( ) = process }
902+
903+ CfgNodes:: ProcessBlockCfgNode getProcessBlock ( ) { result .getAstNode ( ) = process }
904+ }
905+
853906/** A node that performs a type cast. */
854907class CastNode extends Node {
855908 CastNode ( ) { none ( ) }
0 commit comments