@@ -147,7 +147,7 @@ class Node extends TIRDataFlowNode {
147
147
/**
148
148
* INTERNAL: Do not use.
149
149
*/
150
- Declaration getEnclosingCallable ( ) { none ( ) } // overridden in subclasses
150
+ DataFlowCallable getEnclosingCallable ( ) { none ( ) } // overridden in subclasses
151
151
152
152
/** Gets the function to which this node belongs, if any. */
153
153
Declaration getFunction ( ) { none ( ) } // overridden in subclasses
@@ -509,7 +509,9 @@ private class Node0 extends Node, TNode0 {
509
509
510
510
Node0 ( ) { this = TNode0 ( node ) }
511
511
512
- override Declaration getEnclosingCallable ( ) { result = node .getEnclosingCallable ( ) }
512
+ override DataFlowCallable getEnclosingCallable ( ) {
513
+ result .asSourceCallable ( ) = node .getEnclosingCallable ( )
514
+ }
513
515
514
516
override Declaration getFunction ( ) { result = node .getFunction ( ) }
515
517
@@ -574,7 +576,9 @@ class PostUpdateNodeImpl extends PartialDefinitionNode, TPostUpdateNodeImpl {
574
576
575
577
override Declaration getFunction ( ) { result = operand .getUse ( ) .getEnclosingFunction ( ) }
576
578
577
- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
579
+ override DataFlowCallable getEnclosingCallable ( ) {
580
+ result = this .getPreUpdateNode ( ) .getEnclosingCallable ( )
581
+ }
578
582
579
583
/** Gets the operand associated with this node. */
580
584
Operand getOperand ( ) { result = operand }
@@ -627,7 +631,9 @@ class SsaPhiNode extends Node, TSsaPhiNode {
627
631
/** Gets the phi node associated with this node. */
628
632
Ssa:: PhiNode getPhiNode ( ) { result = phi }
629
633
630
- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
634
+ override DataFlowCallable getEnclosingCallable ( ) {
635
+ result .asSourceCallable ( ) = this .getFunction ( )
636
+ }
631
637
632
638
override Declaration getFunction ( ) { result = phi .getBasicBlock ( ) .getEnclosingFunction ( ) }
633
639
@@ -710,7 +716,9 @@ class SsaPhiInputNode extends Node, TSsaPhiInputNode {
710
716
/** Gets the basic block in which this input originates. */
711
717
IRBlock getBlock ( ) { result = block }
712
718
713
- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
719
+ override DataFlowCallable getEnclosingCallable ( ) {
720
+ result .asSourceCallable ( ) = this .getFunction ( )
721
+ }
714
722
715
723
override Declaration getFunction ( ) { result = phi .getBasicBlock ( ) .getEnclosingFunction ( ) }
716
724
@@ -739,7 +747,9 @@ class SsaIteratorNode extends Node, TSsaIteratorNode {
739
747
/** Gets the phi node associated with this node. */
740
748
IteratorFlow:: IteratorFlowNode getIteratorFlowNode ( ) { result = node }
741
749
742
- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
750
+ override DataFlowCallable getEnclosingCallable ( ) {
751
+ result .asSourceCallable ( ) = this .getFunction ( )
752
+ }
743
753
744
754
override Declaration getFunction ( ) { result = node .getFunction ( ) }
745
755
@@ -774,7 +784,9 @@ class SideEffectOperandNode extends Node instanceof IndirectOperand {
774
784
775
785
int getArgumentIndex ( ) { result = argumentIndex }
776
786
777
- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
787
+ override DataFlowCallable getEnclosingCallable ( ) {
788
+ result .asSourceCallable ( ) = this .getFunction ( )
789
+ }
778
790
779
791
override Declaration getFunction ( ) { result = call .getEnclosingFunction ( ) }
780
792
@@ -795,7 +807,9 @@ class FinalGlobalValue extends Node, TFinalGlobalValue {
795
807
/** Gets the underlying SSA use. */
796
808
Ssa:: GlobalUse getGlobalUse ( ) { result = globalUse }
797
809
798
- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
810
+ override DataFlowCallable getEnclosingCallable ( ) {
811
+ result .asSourceCallable ( ) = this .getFunction ( )
812
+ }
799
813
800
814
override Declaration getFunction ( ) { result = globalUse .getIRFunction ( ) .getFunction ( ) }
801
815
@@ -825,7 +839,9 @@ class InitialGlobalValue extends Node, TInitialGlobalValue {
825
839
/** Gets the underlying SSA definition. */
826
840
Ssa:: GlobalDef getGlobalDef ( ) { result = globalDef }
827
841
828
- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
842
+ override DataFlowCallable getEnclosingCallable ( ) {
843
+ result .asSourceCallable ( ) = this .getFunction ( )
844
+ }
829
845
830
846
override Declaration getFunction ( ) { result = globalDef .getIRFunction ( ) .getFunction ( ) }
831
847
@@ -856,7 +872,9 @@ class BodyLessParameterNodeImpl extends Node, TBodyLessParameterNodeImpl {
856
872
857
873
BodyLessParameterNodeImpl ( ) { this = TBodyLessParameterNodeImpl ( p , indirectionIndex ) }
858
874
859
- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
875
+ override DataFlowCallable getEnclosingCallable ( ) {
876
+ result .asSourceCallable ( ) = this .getFunction ( )
877
+ }
860
878
861
879
override Declaration getFunction ( ) { result = p .getFunction ( ) }
862
880
@@ -902,7 +920,9 @@ class FlowSummaryNode extends Node, TFlowSummaryNode {
902
920
* Gets the enclosing callable. For a `FlowSummaryNode` this is always the
903
921
* summarized function this node is part of.
904
922
*/
905
- override Declaration getEnclosingCallable ( ) { result = this .getSummarizedCallable ( ) }
923
+ override DataFlowCallable getEnclosingCallable ( ) {
924
+ result .asSummarizedCallable ( ) = this .getSummarizedCallable ( )
925
+ }
906
926
907
927
override Location getLocationImpl ( ) { result = this .getSummarizedCallable ( ) .getLocation ( ) }
908
928
@@ -923,7 +943,7 @@ class IndirectReturnNode extends Node {
923
943
.hasOperandAndIndirectionIndex ( any ( ReturnValueInstruction ret ) .getReturnAddressOperand ( ) , _)
924
944
}
925
945
926
- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
946
+ override SourceCallable getEnclosingCallable ( ) { result . asSourceCallable ( ) = this .getFunction ( ) }
927
947
928
948
/**
929
949
* Holds if this node represents the value that is returned to the caller
@@ -1117,11 +1137,11 @@ private module RawIndirectNodes {
1117
1137
/** Gets the underlying indirection index. */
1118
1138
int getIndirectionIndex ( ) { result = indirectionIndex }
1119
1139
1120
- override Declaration getFunction ( ) {
1121
- result = this .getOperand ( ) .getDef ( ) .getEnclosingFunction ( )
1122
- }
1140
+ override Declaration getFunction ( ) { result = node .getFunction ( ) }
1123
1141
1124
- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
1142
+ override DataFlowCallable getEnclosingCallable ( ) {
1143
+ result .asSourceCallable ( ) = node .getEnclosingCallable ( )
1144
+ }
1125
1145
1126
1146
override predicate isGLValue ( ) { this .getOperand ( ) .isGLValue ( ) }
1127
1147
@@ -1163,9 +1183,11 @@ private module RawIndirectNodes {
1163
1183
/** Gets the underlying indirection index. */
1164
1184
int getIndirectionIndex ( ) { result = indirectionIndex }
1165
1185
1166
- override Declaration getFunction ( ) { result = this . getInstruction ( ) . getEnclosingFunction ( ) }
1186
+ override Declaration getFunction ( ) { result = node . getFunction ( ) }
1167
1187
1168
- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
1188
+ override DataFlowCallable getEnclosingCallable ( ) {
1189
+ result .asSourceCallable ( ) = node .getEnclosingCallable ( )
1190
+ }
1169
1191
1170
1192
override predicate isGLValue ( ) { this .getInstruction ( ) .isGLValue ( ) }
1171
1193
@@ -1265,7 +1287,9 @@ class FinalParameterNode extends Node, TFinalParameterNode {
1265
1287
1266
1288
override Declaration getFunction ( ) { result = p .getFunction ( ) }
1267
1289
1268
- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
1290
+ override DataFlowCallable getEnclosingCallable ( ) {
1291
+ result .asSourceCallable ( ) = this .getFunction ( )
1292
+ }
1269
1293
1270
1294
override DataFlowType getType ( ) { result = getTypeImpl ( p .getUnderlyingType ( ) , indirectionIndex ) }
1271
1295
@@ -1385,12 +1409,14 @@ private class IndirectInstructionParameterNode extends AbstractIndirectParameter
1385
1409
/** Gets the parameter whose indirection is initialized. */
1386
1410
override Parameter getParameter ( ) { result = init .getParameter ( ) }
1387
1411
1388
- override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
1412
+ override DataFlowCallable getEnclosingCallable ( ) {
1413
+ result .asSourceCallable ( ) = this .getFunction ( )
1414
+ }
1389
1415
1390
1416
override Declaration getFunction ( ) { result = init .getEnclosingFunction ( ) }
1391
1417
1392
1418
override predicate isSourceParameterOf ( Function f , ParameterPosition pos ) {
1393
- this .getEnclosingCallable ( ) = f and
1419
+ this .getFunction ( ) = f and
1394
1420
exists ( int argumentIndex , int indirectionIndex |
1395
1421
indirectPositionHasArgumentIndexAndIndex ( pos , argumentIndex , indirectionIndex ) and
1396
1422
indirectParameterNodeHasArgumentIndexAndIndex ( this , argumentIndex , indirectionIndex )
@@ -1625,13 +1651,13 @@ class VariableNode extends Node, TGlobalLikeVariableNode {
1625
1651
1626
1652
override Declaration getFunction ( ) { none ( ) }
1627
1653
1628
- override Declaration getEnclosingCallable ( ) {
1654
+ override DataFlowCallable getEnclosingCallable ( ) {
1629
1655
// When flow crosses from one _enclosing callable_ to another, the
1630
1656
// interprocedural data-flow library discards call contexts and inserts a
1631
1657
// node in the big-step relation used for human-readable path explanations.
1632
1658
// Therefore we want a distinct enclosing callable for each `VariableNode`,
1633
1659
// and that can be the `Variable` itself.
1634
- result = v
1660
+ result . asSourceCallable ( ) = v
1635
1661
}
1636
1662
1637
1663
override DataFlowType getType ( ) {
0 commit comments