C++: Add an abstract class that can be used to extend 'viableCallable'.

This commit is contained in:
Mathias Vorreiter Pedersen
2023-10-12 10:35:36 +01:00
parent f6570710e7
commit 6865ce56bc
2 changed files with 16 additions and 0 deletions

View File

@@ -27,6 +27,9 @@ DataFlowCallable viableCallable(DataFlowCall call) {
or
// Virtual dispatch
result = call.(VirtualDispatch::DataSensitiveCall).resolve()
or
// Additional call targets
result = any(AdditionalCallTarget additional).viableTarget(call.getUnconvertedResultExpression())
}
/**

View File

@@ -14,6 +14,7 @@ private import DataFlowPrivate
private import ModelUtil
private import SsaInternals as Ssa
private import DataFlowImplCommon as DataFlowImplCommon
private import codeql.util.Unit
/**
* The IR dataflow graph consists of the following nodes:
@@ -2237,3 +2238,15 @@ module InstructionBarrierGuard<instructionGuardChecksSig/3 instructionGuardCheck
)
}
}
/**
* A unit class for adding additional call steps.
*
* Extend this class to add additional call steps to the data flow graph.
*/
class AdditionalCallTarget extends Unit {
/**
* Gets a viable target for `call`.
*/
abstract DataFlowCallable viableTarget(Call call);
}