Skip to content

Commit

Permalink
C++: Make more things 'private' and add QLDoc to public things. (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasVP authored Jan 23, 2024
1 parent da10e6c commit 42fd3fc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
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

0 comments on commit 42fd3fc

Please sign in to comment.