Skip to content

Commit dea11e1

Browse files
authored
Merge branch 'main' into jb1/iac-qlpack
2 parents c99b4de + 555456a commit dea11e1

9 files changed

Lines changed: 26 additions & 26 deletions

File tree

binary/ql/lib/semmle/code/binary/ast/ir/IR.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ private module FinalInstruction {
348348
class FunEntryInstruction extends Instruction instanceof Instruction::FunEntryInstruction { }
349349

350350
class CJumpInstruction extends Instruction instanceof Instruction::CJumpInstruction {
351-
ConditionKind getKind() { result = super.getKind() }
351+
BinaryConditionKind getKind() { result = super.getKind() }
352352

353353
ConditionOperand getConditionOperand() { result = super.getConditionOperand() }
354354

binary/ql/lib/semmle/code/binary/ast/ir/internal/Instruction0/Instruction.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ class ConstInstruction extends Instruction {
112112
class CJumpInstruction extends Instruction {
113113
override Opcode::CJump opcode;
114114

115-
Opcode::ConditionKind getKind() { te.hasJumpCondition(tag, result) }
115+
Opcode::BinaryConditionKind getKind() { te.hasJumpCondition(tag, result) }
116116

117-
override string getImmediateValue() { result = Opcode::stringOfConditionKind(this.getKind()) }
117+
override string getImmediateValue() { result = Opcode::stringOfBinaryConditionKind(this.getKind()) }
118118

119119
ConditionOperand getConditionOperand() { result = this.getAnOperand() }
120120

binary/ql/lib/semmle/code/binary/ast/ir/internal/Instruction0/TranslatedElement.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ abstract class TranslatedElement extends TTranslatedElement {
218218
* Holds if this translated element generates a `CJump` instruction when given the tag `tag`, and
219219
* the condition kind of the jump is `kind`.
220220
*/
221-
predicate hasJumpCondition(InstructionTag tag, Opcode::ConditionKind kind) { none() }
221+
predicate hasJumpCondition(InstructionTag tag, Opcode::BinaryConditionKind kind) { none() }
222222

223223
/**
224224
* Holds if this translated element generates a local variable with the given tag.

binary/ql/lib/semmle/code/binary/ast/ir/internal/Instruction0/TranslatedInstruction.qll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ class TranslatedX86ConditionalJump extends TranslatedX86Instruction, TTranslated
783783
v.isNone() // A jump has no result
784784
}
785785

786-
override predicate hasJumpCondition(InstructionTag tag, Opcode::ConditionKind kind) {
786+
override predicate hasJumpCondition(InstructionTag tag, Opcode::BinaryConditionKind kind) {
787787
tag = SingleTag() and
788788
(
789789
instr instanceof Raw::X86Jb and kind = Opcode::LT()
@@ -1844,7 +1844,7 @@ abstract class TranslatedRelationalInstruction extends TranslatedCilInstruction,
18441844
{
18451845
override Raw::CilRelationalInstruction instr;
18461846

1847-
abstract Opcode::ConditionKind getConditionKind();
1847+
abstract Opcode::BinaryConditionKind getConditionKind();
18481848

18491849
TranslatedRelationalInstruction() { this = TTranslatedCilRelationalInstruction(instr) }
18501850

@@ -1872,7 +1872,7 @@ abstract class TranslatedRelationalInstruction extends TranslatedCilInstruction,
18721872
tag = CilRelVarTag()
18731873
}
18741874

1875-
final override predicate hasJumpCondition(InstructionTag tag, Opcode::ConditionKind kind) {
1875+
final override predicate hasJumpCondition(InstructionTag tag, Opcode::BinaryConditionKind kind) {
18761876
tag = CilRelCJumpTag() and
18771877
kind = this.getConditionKind()
18781878
}
@@ -1940,19 +1940,19 @@ abstract class TranslatedRelationalInstruction extends TranslatedCilInstruction,
19401940
class TranslatedCilClt extends TranslatedRelationalInstruction {
19411941
override Raw::CilClt instr;
19421942

1943-
override Opcode::ConditionKind getConditionKind() { result = Opcode::LT() }
1943+
override Opcode::BinaryConditionKind getConditionKind() { result = Opcode::LT() }
19441944
}
19451945

19461946
class TranslatedCilCgt extends TranslatedRelationalInstruction {
19471947
override Raw::CilCgt instr;
19481948

1949-
override Opcode::ConditionKind getConditionKind() { result = Opcode::GT() }
1949+
override Opcode::BinaryConditionKind getConditionKind() { result = Opcode::GT() }
19501950
}
19511951

19521952
class TranslatedCilCeq extends TranslatedRelationalInstruction {
19531953
override Raw::CilCeq instr;
19541954

1955-
override Opcode::ConditionKind getConditionKind() { result = Opcode::EQ() }
1955+
override Opcode::BinaryConditionKind getConditionKind() { result = Opcode::EQ() }
19561956
}
19571957

19581958
/**
@@ -2004,7 +2004,7 @@ abstract class TranslatedCilBooleanBranchInstruction extends TranslatedCilInstru
20042004
tag = CilBoolBranchSubVarTag()
20052005
}
20062006

2007-
override predicate hasJumpCondition(InstructionTag tag, Opcode::ConditionKind kind) {
2007+
override predicate hasJumpCondition(InstructionTag tag, Opcode::BinaryConditionKind kind) {
20082008
tag = CilBoolBranchCJumpTag() and
20092009
kind = Opcode::EQ()
20102010
}

binary/ql/lib/semmle/code/binary/ast/ir/internal/Instruction1/Instruction1.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ module InstructionInput implements Transform<Instruction0>::TransformInputSig {
369369

370370
abstract Instruction0::Function getEnclosingFunction();
371371

372-
predicate hasJumpCondition(InstructionTag tag, ConditionKind kind) { none() }
372+
predicate hasJumpCondition(InstructionTag tag, BinaryConditionKind kind) { none() }
373373

374374
predicate hasTempVariable(TempVariableTag tag) { none() }
375375

binary/ql/lib/semmle/code/binary/ast/ir/internal/Instruction2/Instruction2.qll

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ private module InstructionInput implements Transform<Instruction1>::TransformInp
208208

209209
private newtype TInstructionTag =
210210
ZeroTag() or
211-
CmpDefTag(ConditionKind k) or
211+
CmpDefTag(BinaryConditionKind k) or
212212
InitializeParameterTag(Instruction1::Variable v) { isReadBeforeInitialization(v, _) }
213213

214214
class LocalVariableTag extends Void {
@@ -228,9 +228,9 @@ private module InstructionInput implements Transform<Instruction1>::TransformInp
228228
this = ZeroTag() and
229229
result = "ZeroTag"
230230
or
231-
exists(ConditionKind k |
231+
exists(BinaryConditionKind k |
232232
this = CmpDefTag(k) and
233-
result = "CmpDefTag(" + stringOfConditionKind(k) + ")"
233+
result = "CmpDefTag(" + stringOfBinaryConditionKind(k) + ")"
234234
)
235235
or
236236
exists(Instruction1::Variable v |
@@ -367,7 +367,7 @@ private module InstructionInput implements Transform<Instruction1>::TransformInp
367367
* There is only a result if the condition part of `cmp` may be undefined.
368368
*/
369369
private predicate controlFlowsToCmp(
370-
Instruction1::Instruction i, Instruction1::CJumpInstruction cjump, ConditionKind kind
370+
Instruction1::Instruction i, Instruction1::CJumpInstruction cjump, BinaryConditionKind kind
371371
) {
372372
// There is control-flow from i to cjump without a write to the
373373
// variable that is used as a condition to cjump
@@ -512,7 +512,7 @@ private module InstructionInput implements Transform<Instruction1>::TransformInp
512512

513513
private newtype TTranslatedElement =
514514
TTranslatedComparisonInstruction(
515-
Instruction1::Instruction i, Instruction1::CJumpInstruction cjump, ConditionKind kind
515+
Instruction1::Instruction i, Instruction1::CJumpInstruction cjump, BinaryConditionKind kind
516516
) {
517517
controlFlowsToCmp(i, cjump, kind)
518518
} or
@@ -539,7 +539,7 @@ private module InstructionInput implements Transform<Instruction1>::TransformInp
539539

540540
int getConstantValue(InstructionTag tag) { none() }
541541

542-
predicate hasJumpCondition(InstructionTag tag, ConditionKind kind) { none() }
542+
predicate hasJumpCondition(InstructionTag tag, BinaryConditionKind kind) { none() }
543543

544544
predicate hasTempVariable(TempVariableTag tag) { none() }
545545

@@ -571,7 +571,7 @@ private module InstructionInput implements Transform<Instruction1>::TransformInp
571571
}
572572

573573
private class TranslatedComparisonInstruction extends TranslatedInstruction {
574-
ConditionKind kind;
574+
BinaryConditionKind kind;
575575
Instruction1::CJumpInstruction cjump;
576576

577577
TranslatedComparisonInstruction() {
@@ -639,7 +639,7 @@ private module InstructionInput implements Transform<Instruction1>::TransformInp
639639
result = 0
640640
}
641641

642-
override predicate hasJumpCondition(InstructionTag tag, ConditionKind k) {
642+
override predicate hasJumpCondition(InstructionTag tag, BinaryConditionKind k) {
643643
kind = k and
644644
tag = CmpDefTag(kind)
645645
}

binary/ql/lib/semmle/code/binary/ast/ir/internal/InstructionSig.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ signature module InstructionSig {
225225
class FunEntryInstruction extends Instruction;
226226

227227
class CJumpInstruction extends Instruction {
228-
ConditionKind getKind();
228+
BinaryConditionKind getKind();
229229

230230
ConditionOperand getConditionOperand();
231231

binary/ql/lib/semmle/code/binary/ast/ir/internal/Opcode.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,15 @@ class FieldAddress extends Opcode, TFieldAddress {
149149
override string toString() { result = "FieldAddress" }
150150
}
151151

152-
newtype ConditionKind =
152+
newtype BinaryConditionKind =
153153
EQ() or
154154
NE() or
155155
LT() or
156156
LE() or
157157
GT() or
158158
GE()
159159

160-
string stringOfConditionKind(ConditionKind cond) {
160+
string stringOfBinaryConditionKind(BinaryConditionKind cond) {
161161
cond = EQ() and
162162
result = "EQ"
163163
or

binary/ql/lib/semmle/code/binary/ast/ir/internal/TransformInstruction/TransformInstruction.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ module Transform<InstructionSig Input> {
9898

9999
Input::Function getStaticTarget(InstructionTag tag);
100100

101-
predicate hasJumpCondition(InstructionTag tag, Opcode::ConditionKind kind);
101+
predicate hasJumpCondition(InstructionTag tag, Opcode::BinaryConditionKind kind);
102102

103103
string toString();
104104

@@ -583,7 +583,7 @@ module Transform<InstructionSig Input> {
583583
class CJumpInstruction extends Instruction {
584584
CJumpInstruction() { this.getOpcode() instanceof Opcode::CJump }
585585

586-
Opcode::ConditionKind getKind() {
586+
Opcode::BinaryConditionKind getKind() {
587587
exists(Input::CJumpInstruction cjump |
588588
this = TOldInstruction(cjump) and
589589
result = cjump.getKind()
@@ -595,7 +595,7 @@ module Transform<InstructionSig Input> {
595595
)
596596
}
597597

598-
override string getImmediateValue() { result = Opcode::stringOfConditionKind(this.getKind()) }
598+
override string getImmediateValue() { result = Opcode::stringOfBinaryConditionKind(this.getKind()) }
599599

600600
ConditionOperand getConditionOperand() { result = this.getAnOperand() }
601601

0 commit comments

Comments
 (0)