@@ -147,7 +147,7 @@ class Node extends TIRDataFlowNode {
147147 /**
148148 * INTERNAL: Do not use.
149149 */
150- Declaration getEnclosingCallable ( ) { none ( ) } // overridden in subclasses
150+ DataFlowCallable getEnclosingCallable ( ) { none ( ) } // overridden in subclasses
151151
152152 /** Gets the function to which this node belongs, if any. */
153153 Declaration getFunction ( ) { none ( ) } // overridden in subclasses
@@ -509,7 +509,9 @@ private class Node0 extends Node, TNode0 {
509509
510510 Node0 ( ) { this = TNode0 ( node ) }
511511
512- override Declaration getEnclosingCallable ( ) { result = node .getEnclosingCallable ( ) }
512+ override DataFlowCallable getEnclosingCallable ( ) {
513+ result .asSourceCallable ( ) = node .getEnclosingCallable ( )
514+ }
513515
514516 override Declaration getFunction ( ) { result = node .getFunction ( ) }
515517
@@ -574,7 +576,9 @@ class PostUpdateNodeImpl extends PartialDefinitionNode, TPostUpdateNodeImpl {
574576
575577 override Declaration getFunction ( ) { result = operand .getUse ( ) .getEnclosingFunction ( ) }
576578
577- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
579+ override DataFlowCallable getEnclosingCallable ( ) {
580+ result = this .getPreUpdateNode ( ) .getEnclosingCallable ( )
581+ }
578582
579583 /** Gets the operand associated with this node. */
580584 Operand getOperand ( ) { result = operand }
@@ -627,7 +631,9 @@ class SsaPhiNode extends Node, TSsaPhiNode {
627631 /** Gets the phi node associated with this node. */
628632 Ssa:: PhiNode getPhiNode ( ) { result = phi }
629633
630- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
634+ override DataFlowCallable getEnclosingCallable ( ) {
635+ result .asSourceCallable ( ) = this .getFunction ( )
636+ }
631637
632638 override Declaration getFunction ( ) { result = phi .getBasicBlock ( ) .getEnclosingFunction ( ) }
633639
@@ -710,7 +716,9 @@ class SsaPhiInputNode extends Node, TSsaPhiInputNode {
710716 /** Gets the basic block in which this input originates. */
711717 IRBlock getBlock ( ) { result = block }
712718
713- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
719+ override DataFlowCallable getEnclosingCallable ( ) {
720+ result .asSourceCallable ( ) = this .getFunction ( )
721+ }
714722
715723 override Declaration getFunction ( ) { result = phi .getBasicBlock ( ) .getEnclosingFunction ( ) }
716724
@@ -739,7 +747,9 @@ class SsaIteratorNode extends Node, TSsaIteratorNode {
739747 /** Gets the phi node associated with this node. */
740748 IteratorFlow:: IteratorFlowNode getIteratorFlowNode ( ) { result = node }
741749
742- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
750+ override DataFlowCallable getEnclosingCallable ( ) {
751+ result .asSourceCallable ( ) = this .getFunction ( )
752+ }
743753
744754 override Declaration getFunction ( ) { result = node .getFunction ( ) }
745755
@@ -774,7 +784,9 @@ class SideEffectOperandNode extends Node instanceof IndirectOperand {
774784
775785 int getArgumentIndex ( ) { result = argumentIndex }
776786
777- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
787+ override DataFlowCallable getEnclosingCallable ( ) {
788+ result .asSourceCallable ( ) = this .getFunction ( )
789+ }
778790
779791 override Declaration getFunction ( ) { result = call .getEnclosingFunction ( ) }
780792
@@ -795,7 +807,9 @@ class FinalGlobalValue extends Node, TFinalGlobalValue {
795807 /** Gets the underlying SSA use. */
796808 Ssa:: GlobalUse getGlobalUse ( ) { result = globalUse }
797809
798- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
810+ override DataFlowCallable getEnclosingCallable ( ) {
811+ result .asSourceCallable ( ) = this .getFunction ( )
812+ }
799813
800814 override Declaration getFunction ( ) { result = globalUse .getIRFunction ( ) .getFunction ( ) }
801815
@@ -825,7 +839,9 @@ class InitialGlobalValue extends Node, TInitialGlobalValue {
825839 /** Gets the underlying SSA definition. */
826840 Ssa:: GlobalDef getGlobalDef ( ) { result = globalDef }
827841
828- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
842+ override DataFlowCallable getEnclosingCallable ( ) {
843+ result .asSourceCallable ( ) = this .getFunction ( )
844+ }
829845
830846 override Declaration getFunction ( ) { result = globalDef .getIRFunction ( ) .getFunction ( ) }
831847
@@ -856,7 +872,9 @@ class BodyLessParameterNodeImpl extends Node, TBodyLessParameterNodeImpl {
856872
857873 BodyLessParameterNodeImpl ( ) { this = TBodyLessParameterNodeImpl ( p , indirectionIndex ) }
858874
859- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
875+ override DataFlowCallable getEnclosingCallable ( ) {
876+ result .asSourceCallable ( ) = this .getFunction ( )
877+ }
860878
861879 override Declaration getFunction ( ) { result = p .getFunction ( ) }
862880
@@ -902,7 +920,9 @@ class FlowSummaryNode extends Node, TFlowSummaryNode {
902920 * Gets the enclosing callable. For a `FlowSummaryNode` this is always the
903921 * summarized function this node is part of.
904922 */
905- override Declaration getEnclosingCallable ( ) { result = this .getSummarizedCallable ( ) }
923+ override DataFlowCallable getEnclosingCallable ( ) {
924+ result .asSummarizedCallable ( ) = this .getSummarizedCallable ( )
925+ }
906926
907927 override Location getLocationImpl ( ) { result = this .getSummarizedCallable ( ) .getLocation ( ) }
908928
@@ -923,7 +943,7 @@ class IndirectReturnNode extends Node {
923943 .hasOperandAndIndirectionIndex ( any ( ReturnValueInstruction ret ) .getReturnAddressOperand ( ) , _)
924944 }
925945
926- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
946+ override SourceCallable getEnclosingCallable ( ) { result . asSourceCallable ( ) = this .getFunction ( ) }
927947
928948 /**
929949 * Holds if this node represents the value that is returned to the caller
@@ -1117,11 +1137,11 @@ private module RawIndirectNodes {
11171137 /** Gets the underlying indirection index. */
11181138 int getIndirectionIndex ( ) { result = indirectionIndex }
11191139
1120- override Declaration getFunction ( ) {
1121- result = this .getOperand ( ) .getDef ( ) .getEnclosingFunction ( )
1122- }
1140+ override Declaration getFunction ( ) { result = node .getFunction ( ) }
11231141
1124- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
1142+ override DataFlowCallable getEnclosingCallable ( ) {
1143+ result .asSourceCallable ( ) = node .getEnclosingCallable ( )
1144+ }
11251145
11261146 override predicate isGLValue ( ) { this .getOperand ( ) .isGLValue ( ) }
11271147
@@ -1163,9 +1183,11 @@ private module RawIndirectNodes {
11631183 /** Gets the underlying indirection index. */
11641184 int getIndirectionIndex ( ) { result = indirectionIndex }
11651185
1166- override Declaration getFunction ( ) { result = this . getInstruction ( ) . getEnclosingFunction ( ) }
1186+ override Declaration getFunction ( ) { result = node . getFunction ( ) }
11671187
1168- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
1188+ override DataFlowCallable getEnclosingCallable ( ) {
1189+ result .asSourceCallable ( ) = node .getEnclosingCallable ( )
1190+ }
11691191
11701192 override predicate isGLValue ( ) { this .getInstruction ( ) .isGLValue ( ) }
11711193
@@ -1265,7 +1287,9 @@ class FinalParameterNode extends Node, TFinalParameterNode {
12651287
12661288 override Declaration getFunction ( ) { result = p .getFunction ( ) }
12671289
1268- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
1290+ override DataFlowCallable getEnclosingCallable ( ) {
1291+ result .asSourceCallable ( ) = this .getFunction ( )
1292+ }
12691293
12701294 override DataFlowType getType ( ) { result = getTypeImpl ( p .getUnderlyingType ( ) , indirectionIndex ) }
12711295
@@ -1385,12 +1409,14 @@ private class IndirectInstructionParameterNode extends AbstractIndirectParameter
13851409 /** Gets the parameter whose indirection is initialized. */
13861410 override Parameter getParameter ( ) { result = init .getParameter ( ) }
13871411
1388- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
1412+ override DataFlowCallable getEnclosingCallable ( ) {
1413+ result .asSourceCallable ( ) = this .getFunction ( )
1414+ }
13891415
13901416 override Declaration getFunction ( ) { result = init .getEnclosingFunction ( ) }
13911417
13921418 override predicate isSourceParameterOf ( Function f , ParameterPosition pos ) {
1393- this .getEnclosingCallable ( ) = f and
1419+ this .getFunction ( ) = f and
13941420 exists ( int argumentIndex , int indirectionIndex |
13951421 indirectPositionHasArgumentIndexAndIndex ( pos , argumentIndex , indirectionIndex ) and
13961422 indirectParameterNodeHasArgumentIndexAndIndex ( this , argumentIndex , indirectionIndex )
@@ -1625,13 +1651,13 @@ class VariableNode extends Node, TGlobalLikeVariableNode {
16251651
16261652 override Declaration getFunction ( ) { none ( ) }
16271653
1628- override Declaration getEnclosingCallable ( ) {
1654+ override DataFlowCallable getEnclosingCallable ( ) {
16291655 // When flow crosses from one _enclosing callable_ to another, the
16301656 // interprocedural data-flow library discards call contexts and inserts a
16311657 // node in the big-step relation used for human-readable path explanations.
16321658 // Therefore we want a distinct enclosing callable for each `VariableNode`,
16331659 // and that can be the `Variable` itself.
1634- result = v
1660+ result . asSourceCallable ( ) = v
16351661 }
16361662
16371663 override DataFlowType getType ( ) {
0 commit comments