@@ -333,9 +333,7 @@ private module IndirectInstructions {
333333import IndirectInstructions
334334
335335/** 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 ( ) }
339337
340338/** Holds if `p` is a `ParameterNode` of `c` with position `pos`. */
341339predicate isParameterNode ( ParameterNode p , DataFlowCallable c , ParameterPosition pos ) {
@@ -1011,10 +1009,8 @@ class CastNode extends Node {
10111009}
10121010
10131011cached
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
10181014 TSummarizedCallable ( FlowSummaryImpl:: Public:: SummarizedCallable c )
10191015
10201016/**
@@ -1127,7 +1123,21 @@ class DataFlowCall extends TDataFlowCall {
11271123 /**
11281124 * Gets the `Function` that the call targets, if this is statically known.
11291125 */
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+ }
11311141
11321142 /**
11331143 * Gets the `index`'th argument operand. The qualifier is considered to have index `-1`.
@@ -1173,14 +1183,12 @@ private class NormalCall extends DataFlowCall, TNormalCall {
11731183
11741184 override CallTargetOperand getCallTargetOperand ( ) { result = call .getCallTargetOperand ( ) }
11751185
1176- override DataFlowCallable getStaticCallTarget ( ) {
1177- result .getUnderlyingCallable ( ) = call .getStaticCallTarget ( )
1178- }
1186+ override Function getStaticCallSourceTarget ( ) { result = call .getStaticCallTarget ( ) }
11791187
11801188 override ArgumentOperand getArgumentOperand ( int index ) { result = call .getArgumentOperand ( index ) }
11811189
11821190 override DataFlowCallable getEnclosingCallable ( ) {
1183- result .getUnderlyingCallable ( ) = call .getEnclosingFunction ( )
1191+ result .asSourceCallable ( ) = call .getEnclosingFunction ( )
11841192 }
11851193
11861194 override string toString ( ) { result = call .toString ( ) }
0 commit comments