@@ -333,9 +333,7 @@ private module IndirectInstructions {
333
333
import IndirectInstructions
334
334
335
335
/** Gets the callable in which this node occurs. */
336
- DataFlowCallable nodeGetEnclosingCallable ( Node n ) {
337
- result .getUnderlyingCallable ( ) = n .getEnclosingCallable ( )
338
- }
336
+ DataFlowCallable nodeGetEnclosingCallable ( Node n ) { result = n .getEnclosingCallable ( ) }
339
337
340
338
/** Holds if `p` is a `ParameterNode` of `c` with position `pos`. */
341
339
predicate isParameterNode ( ParameterNode p , DataFlowCallable c , ParameterPosition pos ) {
@@ -1011,10 +1009,8 @@ class CastNode extends Node {
1011
1009
}
1012
1010
1013
1011
cached
1014
- private newtype TDataFlowCallable =
1015
- TSourceCallable ( Cpp:: Declaration decl ) {
1016
- not decl instanceof FlowSummaryImpl:: Public:: SummarizedCallable
1017
- } or
1012
+ newtype TDataFlowCallable =
1013
+ TSourceCallable ( Cpp:: Declaration decl ) or
1018
1014
TSummarizedCallable ( FlowSummaryImpl:: Public:: SummarizedCallable c )
1019
1015
1020
1016
/**
@@ -1127,7 +1123,21 @@ class DataFlowCall extends TDataFlowCall {
1127
1123
/**
1128
1124
* Gets the `Function` that the call targets, if this is statically known.
1129
1125
*/
1130
- DataFlowCallable getStaticCallTarget ( ) { none ( ) }
1126
+ Function getStaticCallSourceTarget ( ) { none ( ) }
1127
+
1128
+ /**
1129
+ * Gets the target of this call. If a summarized callable exists for the
1130
+ * target this is chosen, and otherwise the callable is the implementation
1131
+ * from the source code.
1132
+ */
1133
+ DataFlowCallable getStaticCallTarget ( ) {
1134
+ exists ( Function target | target = this .getStaticCallSourceTarget ( ) |
1135
+ not exists ( TSummarizedCallable ( target ) ) and
1136
+ result .asSourceCallable ( ) = target
1137
+ or
1138
+ result .asSummarizedCallable ( ) = target
1139
+ )
1140
+ }
1131
1141
1132
1142
/**
1133
1143
* Gets the `index`'th argument operand. The qualifier is considered to have index `-1`.
@@ -1173,14 +1183,12 @@ private class NormalCall extends DataFlowCall, TNormalCall {
1173
1183
1174
1184
override CallTargetOperand getCallTargetOperand ( ) { result = call .getCallTargetOperand ( ) }
1175
1185
1176
- override DataFlowCallable getStaticCallTarget ( ) {
1177
- result .getUnderlyingCallable ( ) = call .getStaticCallTarget ( )
1178
- }
1186
+ override Function getStaticCallSourceTarget ( ) { result = call .getStaticCallTarget ( ) }
1179
1187
1180
1188
override ArgumentOperand getArgumentOperand ( int index ) { result = call .getArgumentOperand ( index ) }
1181
1189
1182
1190
override DataFlowCallable getEnclosingCallable ( ) {
1183
- result .getUnderlyingCallable ( ) = call .getEnclosingFunction ( )
1191
+ result .asSourceCallable ( ) = call .getEnclosingFunction ( )
1184
1192
}
1185
1193
1186
1194
override string toString ( ) { result = call .toString ( ) }
0 commit comments