Skip to content

Commit 387c96d

Browse files
committed
Rename 'SourceVariable.getVariable' to 'SourceVariable.getIRVariable' and replace 'Def.getVariable' to 'Def.getSourceVariable'.
1 parent 12e0185 commit 387c96d

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ abstract class Def extends DefOrUse {
7373
Instruction getInstruction() { result = store }
7474

7575
/** Gets the variable that is defined by this definition. */
76-
abstract SourceVariable getVariable();
76+
abstract SourceVariable getSourceVariable();
7777

7878
/** Holds if this definition is guaranteed to happen. */
7979
abstract predicate isCertain();
@@ -94,10 +94,10 @@ abstract class Def extends DefOrUse {
9494
private class ExplicitDef extends Def, TExplicitDef {
9595
ExplicitDef() { this = TExplicitDef(store) }
9696

97-
override SourceVariable getVariable() {
97+
override SourceVariable getSourceVariable() {
9898
exists(VariableInstruction var |
9999
explicitWrite(_, this.getInstruction(), var) and
100-
result.getVariable() = var.getIRVariable() and
100+
result.getIRVariable() = var.getIRVariable() and
101101
not result.isIndirection()
102102
)
103103
}
@@ -108,11 +108,11 @@ private class ExplicitDef extends Def, TExplicitDef {
108108
private class ParameterDef extends Def, TInitializeParam {
109109
ParameterDef() { this = TInitializeParam(store) }
110110

111-
override SourceVariable getVariable() {
112-
result.getVariable() = store.(InitializeParameterInstruction).getIRVariable() and
111+
override SourceVariable getSourceVariable() {
112+
result.getIRVariable() = store.(InitializeParameterInstruction).getIRVariable() and
113113
not result.isIndirection()
114114
or
115-
result.getVariable() = store.(InitializeIndirectionInstruction).getIRVariable() and
115+
result.getIRVariable() = store.(InitializeIndirectionInstruction).getIRVariable() and
116116
result.isIndirection()
117117
}
118118

@@ -130,7 +130,7 @@ abstract class Use extends DefOrUse {
130130
override string toString() { result = "Use" }
131131

132132
/** Gets the variable that is used by this use. */
133-
abstract SourceVariable getVariable();
133+
abstract SourceVariable getSourceVariable();
134134

135135
override IRBlock getBlock() { result = use.getUse().getBlock() }
136136

@@ -144,10 +144,10 @@ abstract class Use extends DefOrUse {
144144
private class ExplicitUse extends Use, TExplicitUse {
145145
ExplicitUse() { this = TExplicitUse(use) }
146146

147-
override SourceVariable getVariable() {
147+
override SourceVariable getSourceVariable() {
148148
exists(VariableInstruction var |
149149
use.getDef() = var and
150-
result.getVariable() = var.getIRVariable() and
150+
result.getIRVariable() = var.getIRVariable() and
151151
(
152152
if use.getUse() instanceof ReadSideEffectInstruction
153153
then result.isIndirection()
@@ -160,10 +160,10 @@ private class ExplicitUse extends Use, TExplicitUse {
160160
private class ReturnParameterIndirection extends Use, TReturnParamIndirection {
161161
ReturnParameterIndirection() { this = TReturnParamIndirection(use) }
162162

163-
override SourceVariable getVariable() {
163+
override SourceVariable getSourceVariable() {
164164
exists(ReturnIndirectionInstruction ret |
165165
returnParameterIndirection(use, ret) and
166-
result.getVariable() = ret.getIRVariable() and
166+
result.getIRVariable() = ret.getIRVariable() and
167167
result.isIndirection()
168168
)
169169
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ private newtype TSourceVariable =
2121
abstract class SourceVariable extends TSourceVariable {
2222
IRVariable var;
2323

24-
IRVariable getVariable() { result = var }
24+
IRVariable getIRVariable() { result = var }
2525

2626
abstract string toString();
2727

@@ -31,7 +31,7 @@ abstract class SourceVariable extends TSourceVariable {
3131
class SourceIRVariable extends SourceVariable, TSourceIRVariable {
3232
SourceIRVariable() { this = TSourceIRVariable(var) }
3333

34-
override string toString() { result = this.getVariable().toString() }
34+
override string toString() { result = this.getIRVariable().toString() }
3535
}
3636

3737
class SourceIRVariableIndirection extends SourceVariable, TSourceIRVariableIndirection {
@@ -41,7 +41,7 @@ class SourceIRVariableIndirection extends SourceVariable, TSourceIRVariableIndir
4141
this = TSourceIRVariableIndirection(init) and var = init.getIRVariable()
4242
}
4343

44-
override string toString() { result = "*" + this.getVariable().toString() }
44+
override string toString() { result = "*" + this.getIRVariable().toString() }
4545

4646
override predicate isIndirection() { any() }
4747
}
@@ -50,15 +50,15 @@ predicate variableWrite(BasicBlock bb, int i, SourceVariable v, boolean certain)
5050
DataFlowImplCommon::forceCachingInSameStage() and
5151
exists(Ssa::Def def |
5252
def.hasRankInBlock(bb, i) and
53-
v = def.getVariable() and
53+
v = def.getSourceVariable() and
5454
(if def.isCertain() then certain = true else certain = false)
5555
)
5656
}
5757

5858
predicate variableRead(BasicBlock bb, int i, SourceVariable v, boolean certain) {
5959
exists(Ssa::Use use |
6060
use.hasRankInBlock(bb, i) and
61-
v = use.getVariable() and
61+
v = use.getSourceVariable() and
6262
certain = true
6363
)
6464
}

0 commit comments

Comments
 (0)