Skip to content

Commit 32e6d09

Browse files
committed
C++: Drive-by fix: These files imported both the public dataflow files and the internal ones. Let's only import the internal ones.
1 parent 7ede3aa commit 32e6d09

File tree

5 files changed

+18
-23
lines changed

5 files changed

+18
-23
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowDispatch.qll

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
private import cpp
22
private import semmle.code.cpp.ir.IR
3-
private import semmle.code.cpp.ir.dataflow.DataFlow
43
private import DataFlowPrivate
54
private import DataFlowUtil
65
private import DataFlowImplCommon as DataFlowImplCommon
@@ -60,7 +59,7 @@ private module VirtualDispatch {
6059
* `resolve` predicate to stitch that information together and resolve the
6160
* call.
6261
*/
63-
abstract DataFlow::Node getDispatchValue();
62+
abstract Node getDispatchValue();
6463

6564
/** Gets a candidate target for this call. */
6665
abstract Function resolve();
@@ -72,17 +71,13 @@ private module VirtualDispatch {
7271
* parameter is true when the search is allowed to continue backwards into
7372
* a parameter; non-recursive callers should pass `_` for `allowFromArg`.
7473
*/
75-
predicate flowsFrom(DataFlow::Node src, boolean allowFromArg) {
74+
predicate flowsFrom(Node src, boolean allowFromArg) {
7675
src = this.getDispatchValue() and allowFromArg = true
7776
or
78-
exists(DataFlow::Node other, boolean allowOtherFromArg |
79-
this.flowsFrom(other, allowOtherFromArg)
80-
|
77+
exists(Node other, boolean allowOtherFromArg | this.flowsFrom(other, allowOtherFromArg) |
8178
// Call argument
8279
exists(DataFlowCall call, Position i |
83-
other
84-
.(DataFlow::ParameterNode)
85-
.isParameterOf(pragma[only_bind_into](call).getStaticCallTarget(), i) and
80+
other.(ParameterNode).isParameterOf(pragma[only_bind_into](call).getStaticCallTarget(), i) and
8681
src.(ArgumentNode).argumentOf(call, pragma[only_bind_into](pragma[only_bind_out](i)))
8782
) and
8883
allowOtherFromArg = true and
@@ -96,7 +91,7 @@ private module VirtualDispatch {
9691
allowFromArg = false
9792
or
9893
// Local flow
99-
DataFlow::localFlowStep(src, other) and
94+
localFlowStep(src, other) and
10095
allowFromArg = allowOtherFromArg
10196
or
10297
// Flow from global variable to load.
@@ -159,11 +154,11 @@ private module VirtualDispatch {
159154
private class DataSensitiveExprCall extends DataSensitiveCall {
160155
DataSensitiveExprCall() { not exists(this.getStaticCallTarget()) }
161156

162-
override DataFlow::Node getDispatchValue() { result.asOperand() = this.getCallTargetOperand() }
157+
override Node getDispatchValue() { result.asOperand() = this.getCallTargetOperand() }
163158

164159
override Function resolve() {
165160
exists(FunctionInstruction fi |
166-
this.flowsFrom(DataFlow::instructionNode(fi), _) and
161+
this.flowsFrom(instructionNode(fi), _) and
167162
result = fi.getFunctionSymbol()
168163
) and
169164
(
@@ -186,7 +181,7 @@ private module VirtualDispatch {
186181
)
187182
}
188183

189-
override DataFlow::Node getDispatchValue() { result.asInstruction() = this.getArgument(-1) }
184+
override Node getDispatchValue() { result.asInstruction() = this.getArgument(-1) }
190185

191186
override MemberFunction resolve() {
192187
exists(Class overridingClass |
@@ -213,7 +208,7 @@ private module VirtualDispatch {
213208
pragma[noinline]
214209
private predicate hasFlowFromCastFrom(Class derivedClass) {
215210
exists(ConvertToBaseInstruction toBase |
216-
this.flowsFrom(DataFlow::instructionNode(toBase), _) and
211+
this.flowsFrom(instructionNode(toBase), _) and
217212
derivedClass = toBase.getDerivedClass()
218213
)
219214
}
@@ -270,7 +265,7 @@ private predicate mayBenefitFromCallContext(
270265
exists(InitializeParameterInstruction init |
271266
not exists(call.getStaticCallTarget()) and
272267
init.getEnclosingFunction() = f.getUnderlyingCallable() and
273-
call.flowsFrom(DataFlow::instructionNode(init), _) and
268+
call.flowsFrom(instructionNode(init), _) and
274269
init.getParameter().getIndex() = arg
275270
)
276271
}

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/ModelUtil.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
*/
55

66
private import semmle.code.cpp.ir.IR
7-
private import semmle.code.cpp.ir.dataflow.DataFlow
7+
private import semmle.code.cpp.models.interfaces.FunctionInputsAndOutputs
88
private import DataFlowUtil
99
private import DataFlowPrivate
1010
private import SsaImpl as Ssa
1111

1212
/**
1313
* Gets the instruction that goes into `input` for `call`.
1414
*/
15-
DataFlow::Node callInput(CallInstruction call, FunctionInput input) {
15+
Node callInput(CallInstruction call, FunctionInput input) {
1616
// An argument or qualifier
1717
exists(int index |
1818
result.asOperand() = call.getArgumentOperand(index) and
@@ -62,8 +62,8 @@ Node callOutput(CallInstruction call, FunctionOutput output) {
6262
result = callOutputWithIndirectionIndex(call, output, _)
6363
}
6464

65-
DataFlow::Node callInput(CallInstruction call, FunctionInput input, int d) {
66-
exists(DataFlow::Node n | n = callInput(call, input) and d > 0 |
65+
Node callInput(CallInstruction call, FunctionInput input, int d) {
66+
exists(Node n | n = callInput(call, input) and d > 0 |
6767
// An argument or qualifier
6868
hasOperandAndIndex(result, n.asOperand(), d)
6969
or
@@ -85,7 +85,7 @@ private IndirectReturnOutNode getIndirectReturnOutNode(CallInstruction call, int
8585
*/
8686
bindingset[d]
8787
Node callOutput(CallInstruction call, FunctionOutput output, int d) {
88-
exists(DataFlow::Node n, int indirectionIndex |
88+
exists(Node n, int indirectionIndex |
8989
n = callOutputWithIndirectionIndex(call, output, indirectionIndex) and d > 0
9090
|
9191
// The return value

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/PrintDataFlowRelevantIR.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
private import cpp
22
private import semmle.code.cpp.ir.IR
3-
private import SsaInternals as Ssa
3+
private import SsaImpl as Ssa
44

55
/**
66
* A property provider that hides all instructions and operands that are not relevant for IR dataflow.

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/PrintIRLocalFlow.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ private import cpp
22
private import semmle.code.cpp.ir.IR
33
private import semmle.code.cpp.ir.dataflow.internal.DataFlowUtil
44
private import semmle.code.cpp.ir.dataflow.internal.DataFlowPrivate
5-
private import SsaInternals as Ssa
5+
private import SsaImpl as Ssa
66
private import PrintIRUtilities
77

88
/**

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/TaintTrackingUtil.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ private import semmle.code.cpp.models.interfaces.DataFlow
55
private import semmle.code.cpp.models.interfaces.SideEffect
66
private import DataFlowUtil
77
private import DataFlowPrivate
8-
private import SsaInternals as Ssa
8+
private import SsaImpl as Ssa
99
private import semmle.code.cpp.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
1010
private import semmle.code.cpp.ir.dataflow.FlowSteps
1111

0 commit comments

Comments
 (0)