Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ predicate strictlyDominates(IRBlock b1, int i1, IRBlock b2, int i2) {
b1.strictlyDominates(b2)
}

/**
* The signature for a module that is used to specify the inputs to the `FlowFromFree` module.
*/
signature module FlowFromFreeParamSig {
/**
* Signature for a predicate that holds if `n.asExpr() = e` and `n` is a sink in
* the `FlowFromFreeConfig` module.
* Holds if `n.asExpr() = e` and `n` is a sink in the `FlowFromFreeConfig`
* module.
*/
predicate isSink(DataFlow::Node n, Expr e);

Expand Down Expand Up @@ -60,7 +63,7 @@ signature module FlowFromFreeParamSig {
* 2. The sink post-dominates the source.
*/
module FlowFromFree<FlowFromFreeParamSig P> {
module FlowFromFreeConfig implements DataFlow::StateConfigSig {
private module FlowFromFreeConfig implements DataFlow::StateConfigSig {
class FlowState instanceof Expr {
FlowState() { isFree(_, _, this, _) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ predicate isUse0(Expr e) {
)
}

module ParameterSinks {
private module ParameterSinks {
import semmle.code.cpp.ir.ValueNumbering

predicate flowsToUse(DataFlow::Node n) {
private predicate flowsToUse(DataFlow::Node n) {
isUse0(n.asExpr())
or
exists(DataFlow::Node succ |
Expand Down Expand Up @@ -131,9 +131,15 @@ module ParameterSinks {
}
}

module IsUse {
private module IsUse {
private import semmle.code.cpp.ir.dataflow.internal.DataFlowImplCommon

/**
* Holds if `n` represents the expression `e`, and `e` is a pointer that is
* guarenteed to be dereferenced (either because it's an operand of a
* dereference operation, or because it's an argument to a function that
* always dereferences the parameter).
*/
predicate isUse(DataFlow::Node n, Expr e) {
isUse0(e) and n.asExpr() = e
or
Expand Down