Skip to content

Commit e18b36b

Browse files
author
AndreiDiaconu1
committed
Make preds private, autoformat
1 parent 3a83dc5 commit e18b36b

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
lines changed

csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/IRConstruction.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ TranslatedElement getInstructionTranslatedElement(Instruction instruction) {
1717
}
1818

1919
InstructionTag getInstructionTag(Instruction instruction) { instruction = MkInstruction(_, result) }
20-
2120
import Cached
2221

2322
cached
@@ -317,7 +316,6 @@ private module Cached {
317316
cached
318317
Language::BuiltInOperation getInstructionBuiltInOperation(Instruction instr) { none() }
319318
}
320-
321319
import CachedForDebugging
322320

323321
cached

csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/TranslatedElement.qll

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,12 @@ private predicate ignoreExprAndDescendants(Expr expr) {
7575
expr instanceof LocalVariableDeclExpr and
7676
expr.getParent() instanceof ForeachStmt
7777
or
78-
(
79-
// recursive case
80-
ignoreExprAndDescendants(getRealParent(expr)) and
81-
// The two children of an `AssignOperation` should not be ignored, but since they are also
82-
// descendants of an orphan node (the expanded form of the `AssignOperation` is also retrieved by
83-
// the extractor, which is rooted in an AST node without parents) they would be
84-
not expr.getParent() instanceof AssignOperation
85-
)
78+
// recursive case
79+
ignoreExprAndDescendants(getRealParent(expr)) and
80+
// The two children of an `AssignOperation` should not be ignored, but since they are also
81+
// descendants of an orphan node (the expanded form of the `AssignOperation` is also retrieved by
82+
// the extractor, which is rooted in an AST node without parents) they would be
83+
not expr.getParent() instanceof AssignOperation
8684
}
8785

8886
/**
@@ -177,7 +175,7 @@ private predicate usedAsCondition(Expr expr) {
177175
/**
178176
* Holds if we should have a `Load` instruction for `expr` when generating the IR.
179177
*/
180-
predicate mayNeedLoad(Expr expr) {
178+
private predicate mayNeedLoad(Expr expr) {
181179
expr instanceof AssignableRead
182180
or
183181
// We need an extra load for the `PointerIndirectionExpr`
@@ -195,7 +193,7 @@ predicate needsLoad(Expr expr) {
195193
/**
196194
* Holds if we should ignore the `Load` instruction for `expr` when generating IR.
197195
*/
198-
predicate ignoreLoad(Expr expr) {
196+
private predicate ignoreLoad(Expr expr) {
199197
// No load needed for the qualifier
200198
// in an array access
201199
expr = any(ArrayAccess aa).getQualifier()
@@ -219,12 +217,12 @@ predicate ignoreLoad(Expr expr) {
219217
// given by a single `VariableAddress` instruction.
220218
expr = any(FieldAccess fa).getQualifier() and
221219
expr = any(VariableAccess va |
222-
va.getType().isValueType() and
223-
not va.getTarget() = any(Parameter p | p.isOutOrRef() or p.isIn())
224-
)
220+
va.getType().isValueType() and
221+
not va.getTarget() = any(Parameter p | p.isOutOrRef() or p.isIn())
222+
)
225223
or
226224
// If expr is passed as an `out,`ref` or `in` argument,
227-
// no load should take place since we pass the address, not the
225+
// no load should take place since we pass the address, not the
228226
// value of the variable
229227
expr.(AssignableAccess).isOutOrRefArgument()
230228
or

csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/TranslatedExpr.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ class TranslatedNonFieldVariableAccess extends TranslatedVariableAccess {
853853
else result = this.getInstruction(AddressTag())
854854
}
855855

856-
override Instruction getInstructionOperand(InstructionTag tag, OperandTag operandTag) {
856+
override Instruction getInstructionOperand(InstructionTag tag, OperandTag operandTag) {
857857
result = TranslatedVariableAccess.super.getInstructionOperand(tag, operandTag)
858858
}
859859

csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/TranslatedStmt.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,9 @@ class TranslatedFixedStmt extends TranslatedStmt {
961961

962962
override Instruction getChildSuccessor(TranslatedElement child) {
963963
exists(int id |
964-
child = this.getDecl(id) and id < this.noDecls() - 1 and result = this.getDecl(id + 1).getFirstInstruction()
964+
child = this.getDecl(id) and
965+
id < this.noDecls() - 1 and
966+
result = this.getDecl(id + 1).getFirstInstruction()
965967
)
966968
or
967969
child = this.getDecl(this.noDecls() - 1) and result = this.getBody().getFirstInstruction()

csharp/ql/src/semmle/code/csharp/ir/internal/IRCSharpLanguage.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class BuiltInOperation extends TBuiltInOperation {
2929

3030
class ClassDerivation extends MkClassDerivation {
3131
Class baseClass;
32+
3233
Class derivedClass;
3334

3435
ClassDerivation() { this = MkClassDerivation(baseClass, derivedClass) }

0 commit comments

Comments
 (0)