Skip to content

Commit a2e3b37

Browse files
committed
Dataflow: Fix accidental visibility.
1 parent 4dca4a7 commit a2e3b37

File tree

1 file changed

+81
-75
lines changed

1 file changed

+81
-75
lines changed

shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll

Lines changed: 81 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -4364,13 +4364,15 @@ module MakeImpl<InputSig Lang> {
43644364
private predicate flagDisable() { none() }
43654365

43664366
module FlowExplorationFwd<explorationLimitSig/0 explorationLimit> {
4367-
import FlowExploration<explorationLimit/0, flagEnable/0, flagDisable/0>
4367+
private import FlowExploration<explorationLimit/0, flagEnable/0, flagDisable/0>
4368+
import Public
43684369

43694370
predicate partialFlow = partialFlowFwd/3;
43704371
}
43714372

43724373
module FlowExplorationRev<explorationLimitSig/0 explorationLimit> {
4373-
import FlowExploration<explorationLimit/0, flagDisable/0, flagEnable/0>
4374+
private import FlowExploration<explorationLimit/0, flagDisable/0, flagEnable/0>
4375+
import Public
43744376

43754377
predicate partialFlow = partialFlowRev/3;
43764378
}
@@ -4617,96 +4619,100 @@ module MakeImpl<InputSig Lang> {
46174619
partialPathStep1(_, _, _, _, _, _, _, _, t0, t, ap) and t0 != t
46184620
}
46194621

4620-
/**
4621-
* A `Node` augmented with a call context, an access path, and a configuration.
4622-
*/
4623-
class PartialPathNode extends TPartialPathNode {
4624-
/** Gets a textual representation of this element. */
4625-
string toString() { result = this.getNodeEx().toString() + this.ppType() + this.ppAp() }
4626-
4622+
module Public {
46274623
/**
4628-
* Gets a textual representation of this element, including a textual
4629-
* representation of the call context.
4624+
* A `Node` augmented with a call context, an access path, and a configuration.
46304625
*/
4631-
string toStringWithContext() {
4632-
result = this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx()
4633-
}
4626+
class PartialPathNode extends TPartialPathNode {
4627+
/** Gets a textual representation of this element. */
4628+
string toString() { result = this.getNodeEx().toString() + this.ppType() + this.ppAp() }
4629+
4630+
/**
4631+
* Gets a textual representation of this element, including a textual
4632+
* representation of the call context.
4633+
*/
4634+
string toStringWithContext() {
4635+
result = this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx()
4636+
}
46344637

4635-
/**
4636-
* Holds if this element is at the specified location.
4637-
* The location spans column `startcolumn` of line `startline` to
4638-
* column `endcolumn` of line `endline` in file `filepath`.
4639-
* For more information, see
4640-
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
4641-
*/
4642-
predicate hasLocationInfo(
4643-
string filepath, int startline, int startcolumn, int endline, int endcolumn
4644-
) {
4645-
this.getNodeEx().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
4646-
}
4638+
/**
4639+
* Holds if this element is at the specified location.
4640+
* The location spans column `startcolumn` of line `startline` to
4641+
* column `endcolumn` of line `endline` in file `filepath`.
4642+
* For more information, see
4643+
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
4644+
*/
4645+
predicate hasLocationInfo(
4646+
string filepath, int startline, int startcolumn, int endline, int endcolumn
4647+
) {
4648+
this.getNodeEx().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
4649+
}
46474650

4648-
/** Gets the underlying `Node`. */
4649-
final Node getNode() { this.getNodeEx().projectToNode() = result }
4651+
/** Gets the underlying `Node`. */
4652+
final Node getNode() { this.getNodeEx().projectToNode() = result }
46504653

4651-
FlowState getState() { none() }
4654+
FlowState getState() { none() }
46524655

4653-
private NodeEx getNodeEx() {
4654-
result = this.(PartialPathNodeFwd).getNodeEx() or
4655-
result = this.(PartialPathNodeRev).getNodeEx()
4656-
}
4656+
private NodeEx getNodeEx() {
4657+
result = this.(PartialPathNodeFwd).getNodeEx() or
4658+
result = this.(PartialPathNodeRev).getNodeEx()
4659+
}
46574660

4658-
/** Gets a successor of this node, if any. */
4659-
PartialPathNode getASuccessor() { none() }
4661+
/** Gets a successor of this node, if any. */
4662+
PartialPathNode getASuccessor() { none() }
46604663

4661-
/**
4662-
* Gets the approximate distance to the nearest source measured in number
4663-
* of interprocedural steps.
4664-
*/
4665-
int getSourceDistance() { result = distSrc(this.getNodeEx().getEnclosingCallable()) }
4664+
/**
4665+
* Gets the approximate distance to the nearest source measured in number
4666+
* of interprocedural steps.
4667+
*/
4668+
int getSourceDistance() { result = distSrc(this.getNodeEx().getEnclosingCallable()) }
46664669

4667-
/**
4668-
* Gets the approximate distance to the nearest sink measured in number
4669-
* of interprocedural steps.
4670-
*/
4671-
int getSinkDistance() { result = distSink(this.getNodeEx().getEnclosingCallable()) }
4670+
/**
4671+
* Gets the approximate distance to the nearest sink measured in number
4672+
* of interprocedural steps.
4673+
*/
4674+
int getSinkDistance() { result = distSink(this.getNodeEx().getEnclosingCallable()) }
46724675

4673-
private string ppType() {
4674-
this instanceof PartialPathNodeRev and result = ""
4675-
or
4676-
exists(DataFlowType t | t = this.(PartialPathNodeFwd).getType() |
4677-
// The `concat` becomes "" if `ppReprType` has no result.
4678-
result = concat(" : " + ppReprType(t))
4679-
)
4680-
}
4676+
private string ppType() {
4677+
this instanceof PartialPathNodeRev and result = ""
4678+
or
4679+
exists(DataFlowType t | t = this.(PartialPathNodeFwd).getType() |
4680+
// The `concat` becomes "" if `ppReprType` has no result.
4681+
result = concat(" : " + ppReprType(t))
4682+
)
4683+
}
46814684

4682-
private string ppAp() {
4683-
exists(string s |
4684-
s = this.(PartialPathNodeFwd).getAp().toString() or
4685-
s = this.(PartialPathNodeRev).getAp().toString()
4686-
|
4687-
if s = "" then result = "" else result = " " + s
4688-
)
4689-
}
4685+
private string ppAp() {
4686+
exists(string s |
4687+
s = this.(PartialPathNodeFwd).getAp().toString() or
4688+
s = this.(PartialPathNodeRev).getAp().toString()
4689+
|
4690+
if s = "" then result = "" else result = " " + s
4691+
)
4692+
}
46904693

4691-
private string ppCtx() {
4692-
result = " <" + this.(PartialPathNodeFwd).getCallContext().toString() + ">"
4693-
}
4694+
private string ppCtx() {
4695+
result = " <" + this.(PartialPathNodeFwd).getCallContext().toString() + ">"
4696+
}
46944697

4695-
/** Holds if this is a source in a forward-flow path. */
4696-
predicate isFwdSource() { this.(PartialPathNodeFwd).isSource() }
4698+
/** Holds if this is a source in a forward-flow path. */
4699+
predicate isFwdSource() { this.(PartialPathNodeFwd).isSource() }
46974700

4698-
/** Holds if this is a sink in a reverse-flow path. */
4699-
predicate isRevSink() { this.(PartialPathNodeRev).isSink() }
4700-
}
4701+
/** Holds if this is a sink in a reverse-flow path. */
4702+
predicate isRevSink() { this.(PartialPathNodeRev).isSink() }
4703+
}
47014704

4702-
/**
4703-
* Provides the query predicates needed to include a graph in a path-problem query.
4704-
*/
4705-
module PartialPathGraph {
4706-
/** Holds if `(a,b)` is an edge in the graph of data flow path explanations. */
4707-
query predicate edges(PartialPathNode a, PartialPathNode b) { a.getASuccessor() = b }
4705+
/**
4706+
* Provides the query predicates needed to include a graph in a path-problem query.
4707+
*/
4708+
module PartialPathGraph {
4709+
/** Holds if `(a,b)` is an edge in the graph of data flow path explanations. */
4710+
query predicate edges(PartialPathNode a, PartialPathNode b) { a.getASuccessor() = b }
4711+
}
47084712
}
47094713

4714+
import Public
4715+
47104716
private class PartialPathNodeFwd extends PartialPathNode, TPartialPathNodeFwd {
47114717
NodeEx node;
47124718
FlowState state;

0 commit comments

Comments
 (0)