mirror of
https://github.com/github/codeql.git
synced 2026-05-01 19:55:15 +02:00
C++: Add DataFlow::instructionNode
This is for symmetry with `exprNode` etc., and it should be handy for the same reasons. I found one caller of `asInstruction` that got simpler by using the new predicate instead.
This commit is contained in:
@@ -22,10 +22,7 @@ private predicate predictable(Expr expr) {
|
||||
|
||||
// TODO: remove when `predictable` has an `Instruction` parameter instead of `Expr`.
|
||||
private predicate predictableInstruction(Instruction instr) {
|
||||
exists(DataFlow::Node node |
|
||||
node.asInstruction() = instr and
|
||||
predictable(node.asExpr())
|
||||
)
|
||||
predictable(DataFlow::instructionNode(instr).asExpr())
|
||||
}
|
||||
|
||||
private class DefaultTaintTrackingCfg extends DataFlow::Configuration {
|
||||
|
||||
@@ -156,6 +156,11 @@ abstract class PostUpdateNode extends Node {
|
||||
abstract Node getPreUpdateNode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the node corresponding to `instr`.
|
||||
*/
|
||||
Node instructionNode(Instruction instr) { result.asInstruction() = instr }
|
||||
|
||||
/**
|
||||
* Gets a `Node` corresponding to `e` or any of its conversions. There is no
|
||||
* result if `e` is a `Conversion`.
|
||||
|
||||
Reference in New Issue
Block a user