Skip to content

Commit 6865ce5

Browse files
committed
C++: Add an abstract class that can be used to extend 'viableCallable'.
1 parent f657071 commit 6865ce5

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowDispatch.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ DataFlowCallable viableCallable(DataFlowCall call) {
2727
or
2828
// Virtual dispatch
2929
result = call.(VirtualDispatch::DataSensitiveCall).resolve()
30+
or
31+
// Additional call targets
32+
result = any(AdditionalCallTarget additional).viableTarget(call.getUnconvertedResultExpression())
3033
}
3134

3235
/**

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ private import DataFlowPrivate
1414
private import ModelUtil
1515
private import SsaInternals as Ssa
1616
private import DataFlowImplCommon as DataFlowImplCommon
17+
private import codeql.util.Unit
1718

1819
/**
1920
* The IR dataflow graph consists of the following nodes:
@@ -2237,3 +2238,15 @@ module InstructionBarrierGuard<instructionGuardChecksSig/3 instructionGuardCheck
22372238
)
22382239
}
22392240
}
2241+
2242+
/**
2243+
* A unit class for adding additional call steps.
2244+
*
2245+
* Extend this class to add additional call steps to the data flow graph.
2246+
*/
2247+
class AdditionalCallTarget extends Unit {
2248+
/**
2249+
* Gets a viable target for `call`.
2250+
*/
2251+
abstract DataFlowCallable viableTarget(Call call);
2252+
}

0 commit comments

Comments
 (0)