@@ -61,6 +61,15 @@ private newtype TIRDataFlowNode =
61
61
} or
62
62
TFinalGlobalValue ( Ssa:: GlobalUse globalUse ) or
63
63
TInitialGlobalValue ( Ssa:: GlobalDef globalUse ) or
64
+ TBodyLessParameterNodeImpl ( Parameter p , int indirectionIndex ) {
65
+ // Rule out parameters of catch blocks.
66
+ not exists ( p .getCatchBlock ( ) ) and
67
+ // We subtract one because `getMaxIndirectionsForType` returns the maximum
68
+ // indirection for a glvalue of a given type, and this doesn't apply to
69
+ // parameters.
70
+ indirectionIndex = [ 0 .. Ssa:: getMaxIndirectionsForType ( p .getUnspecifiedType ( ) ) - 1 ] and
71
+ not any ( InitializeParameterInstruction init ) .getParameter ( ) = p
72
+ } or
64
73
TFlowSummaryNode ( FlowSummaryImpl:: Private:: SummaryNode sn )
65
74
66
75
/**
@@ -737,6 +746,40 @@ class InitialGlobalValue extends Node, TInitialGlobalValue {
737
746
override string toStringImpl ( ) { result = globalDef .toString ( ) }
738
747
}
739
748
749
+ /**
750
+ * INTERNAL: do not use.
751
+ *
752
+ * A node representing a parameter for a function with no body.
753
+ */
754
+ class BodyLessParameterNodeImpl extends Node , TBodyLessParameterNodeImpl {
755
+ Parameter p ;
756
+ int indirectionIndex ;
757
+
758
+ BodyLessParameterNodeImpl ( ) { this = TBodyLessParameterNodeImpl ( p , indirectionIndex ) }
759
+
760
+ override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
761
+
762
+ override Declaration getFunction ( ) { result = p .getFunction ( ) }
763
+
764
+ /** Gets the indirection index of this node. */
765
+ int getIndirectionIndex ( ) { result = indirectionIndex }
766
+
767
+ override DataFlowType getType ( ) {
768
+ result = getTypeImpl ( p .getUnderlyingType ( ) , this .getIndirectionIndex ( ) )
769
+ }
770
+
771
+ final override Location getLocationImpl ( ) {
772
+ result = unique( | | p .getLocation ( ) )
773
+ or
774
+ count ( p .getLocation ( ) ) != 1 and
775
+ result instanceof UnknownDefaultLocation
776
+ }
777
+
778
+ final override string toStringImpl ( ) {
779
+ exists ( string prefix | prefix = stars ( this ) | result = prefix + p .toString ( ) )
780
+ }
781
+ }
782
+
740
783
/**
741
784
* A data-flow node used to model flow summaries. That is, a dataflow node
742
785
* that is synthesized to represent a parameter, return value, or other part
0 commit comments