@@ -77,16 +77,6 @@ module CfgImpl {
7777 )
7878 }
7979
80- private AstNode getLastCfgAstNode ( AstNode node ) {
81- not exists ( getCfgChild ( node , _) ) and result = node
82- or
83- exists ( AstNode child , int index |
84- child = getCfgChild ( node , index ) and
85- not exists ( int later | later > index and exists ( getCfgChild ( node , later ) ) ) and
86- result = getLastCfgAstNode ( child )
87- )
88- }
89-
9080 private module CfgAst implements CfgShared:: AstSig< Location > {
9181 class AstNode = ActionsAstNode ;
9282
@@ -397,54 +387,23 @@ module CfgImpl {
397387 /** A CFG scope for a composite action. */
398388 class CompositeActionScope extends CfgScope instanceof CompositeAction { }
399389
400- /**
401- * A control flow node.
402- *
403- * Only nodes that can be reached from an entry point are included in the CFG.
404- */
405- class Node extends ControlFlowNode {
406- /** Gets the CFG scope containing this node. */
407- CfgScope getScope ( ) { result = this .getEnclosingCallable ( ) }
408-
409- Node getASuccessor ( SuccessorType type ) { result = super .getASuccessor ( type ) }
410-
411- Node getASuccessor ( ) { result = super .getASuccessor ( ) }
412-
413- /** Gets an immediate predecessor connected by an edge of type `type`, if any. */
414- Node getAPredecessor ( SuccessorType type ) { result .getASuccessor ( type ) = this }
415-
416- Node getAPredecessor ( ) { result = super .getAPredecessor ( ) }
417-
418- /** Holds if this node has a conditional successor. */
419- predicate isCondition ( ) { exists ( this .getASuccessor ( any ( ConditionalSuccessor successor ) ) ) }
420-
421- /** Holds if this node has more than one predecessor. */
422- predicate isJoin ( ) { strictcount ( this .getAPredecessor ( ) ) > 1 }
423-
424- /** Holds if this node has more than one successor. */
425- predicate isBranch ( ) { strictcount ( this .getASuccessor ( ) ) > 1 }
426- }
390+ /** A control flow node. */
391+ class Node = ControlFlowNode ;
427392
428393 /** The control flow node at the entry point of a scope. */
429- class EntryNode extends Node , ControlFlow:: EntryNode { }
394+ class EntryNode = ControlFlow:: EntryNode ;
430395
431396 /** A control flow node indicating normal or exceptional termination of a scope. */
432- class AnnotatedExitNode extends Node , ControlFlow:: AnnotatedExitNode {
433- /** Holds if this node represents a normal exit. */
434- predicate isNormal ( ) { this instanceof NormalExitNode }
435- }
397+ class AnnotatedExitNode = ControlFlow:: AnnotatedExitNode ;
436398
437399 /** A control flow node indicating normal termination of a scope. */
438- class NormalExitNode extends AnnotatedExitNode , ControlFlow:: NormalExitNode { }
400+ class NormalExitNode = ControlFlow:: NormalExitNode ;
439401
440402 /** A control flow node indicating exceptional termination of a scope. */
441- class ExceptionalExitNode extends AnnotatedExitNode , ControlFlow:: ExceptionalExitNode { }
403+ class ExceptionalExitNode = ControlFlow:: ExceptionalExitNode ;
442404
443405 /** A control flow node indicating the termination of a scope. */
444- class ExitNode extends Node , ControlFlow:: ExitNode { }
445-
446- /** The empty split type retained for compatibility with the legacy Actions CFG. */
447- class Split = Void ;
406+ class ExitNode = ControlFlow:: ExitNode ;
448407
449408 /**
450409 * A node that uniquely represents an AST node.
@@ -455,35 +414,5 @@ module CfgImpl {
455414 AstCfgNode ( ) { this .injects ( _) }
456415
457416 AstNode getAstNode ( ) { this .injects ( result ) }
458-
459- /** Gets a comma-separated list of splits in this node, if any. */
460- string getSplitsString ( ) { none ( ) }
461-
462- /** Gets a split for this control flow node, if any. */
463- Split getASplit ( ) { none ( ) }
464417 }
465-
466- /**
467- * If needed, call this predicate to force a stage dependency on the cached CFG stage.
468- */
469- cached
470- predicate forceCachingInSameStage ( ) { CfgCachedStage:: ref ( ) }
471-
472- /** Gets the first AST node executed within `node`. */
473- cached
474- AstNode getAControlFlowEntryNode ( AstNode node ) {
475- result = node and
476- exists ( Node cfgNode | cfgNode .injects ( node ) )
477- }
478-
479- /** Gets a potential last AST node executed within `node`. */
480- cached
481- AstNode getAControlFlowExitNode ( AstNode node ) {
482- exists ( Node cfgNode | cfgNode .injects ( node ) ) and
483- result = getLastCfgAstNode ( node )
484- }
485-
486- /** Gets the CFG scope of `node`. */
487- cached
488- CfgScope getNodeCfgScope ( Node node ) { result = node .getScope ( ) }
489418}
0 commit comments