Skip to content

Commit bb83b92

Browse files
committed
C#: Autoformat
1 parent e7d8fa4 commit bb83b92

File tree

8 files changed

+26
-30
lines changed

8 files changed

+26
-30
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ private predicate canCreateCompilerGeneratedElement(Element generatedBy, int nth
3333
generatedBy instanceof DelegateCreation and
3434
nth in [0 .. DelegateElements::noGeneratedElements(generatedBy)]
3535
or
36-
generatedBy instanceof DelegateCall and nth in [0 .. DelegateElements::noGeneratedElements(generatedBy)]
36+
generatedBy instanceof DelegateCall and
37+
nth in [0 .. DelegateElements::noGeneratedElements(generatedBy)]
3738
}
3839

3940
/**
@@ -223,9 +224,7 @@ newtype TTranslatedElement =
223224
// Because of their implementation in C#,
224225
// we deal with all the types of initialization separately.
225226
// First only simple local variable initialization (ie. `int x = 0`)
226-
exists(LocalVariableDeclAndInitExpr lvInit |
227-
lvInit.getInitializer() = expr
228-
)
227+
exists(LocalVariableDeclAndInitExpr lvInit | lvInit.getInitializer() = expr)
229228
or
230229
// Then treat more complex ones
231230
expr instanceof ArrayInitializer

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

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -750,40 +750,37 @@ abstract class TranslatedSpecificJump extends TranslatedStmt {
750750
class TranslatedBreakStmt extends TranslatedSpecificJump {
751751
override BreakStmt stmt;
752752

753-
override Instruction getTargetInstruction() {
754-
result = getEnclosingLoopOrSwitchNextInstr(stmt)
755-
}
753+
override Instruction getTargetInstruction() { result = getEnclosingLoopOrSwitchNextInstr(stmt) }
756754
}
757755

758756
private Instruction getEnclosingLoopOrSwitchNextInstr(Stmt crtStmt) {
759757
if crtStmt instanceof LoopStmt or crtStmt instanceof SwitchStmt
760-
then
761-
result = getTranslatedStmt(crtStmt).getParent().getChildSuccessor(getTranslatedStmt(crtStmt))
758+
then result = getTranslatedStmt(crtStmt).getParent().getChildSuccessor(getTranslatedStmt(crtStmt))
762759
else result = getEnclosingLoopOrSwitchNextInstr(crtStmt.getParent())
763760
}
764761

765762
class TranslatedContinueStmt extends TranslatedSpecificJump {
766763
override ContinueStmt stmt;
767764

768-
override Instruction getTargetInstruction() {
769-
result = getEnclosingLoopTargetInstruction(stmt)
770-
}
765+
override Instruction getTargetInstruction() { result = getEnclosingLoopTargetInstruction(stmt) }
771766
}
772767

773768
private Instruction getEnclosingLoopTargetInstruction(Stmt crtStmt) {
774769
if crtStmt instanceof ForStmt
775770
then result = getNextForInstruction(crtStmt)
776-
else if crtStmt instanceof LoopStmt
777-
then result = getTranslatedStmt(crtStmt).getFirstInstruction()
778-
else result = getEnclosingLoopTargetInstruction(crtStmt.getParent())
771+
else
772+
if crtStmt instanceof LoopStmt
773+
then result = getTranslatedStmt(crtStmt).getFirstInstruction()
774+
else result = getEnclosingLoopTargetInstruction(crtStmt.getParent())
779775
}
780776

781777
private Instruction getNextForInstruction(ForStmt for) {
782778
if exists(for.getUpdate(0))
783779
then result = getTranslatedStmt(for).(TranslatedForStmt).getUpdate(0).getFirstInstruction()
784-
else if exists(for.getCondition())
785-
then result = getTranslatedStmt(for).(TranslatedForStmt).getCondition().getFirstInstruction()
786-
else result = getTranslatedStmt(for).(TranslatedForStmt).getBody().getFirstInstruction()
780+
else
781+
if exists(for.getCondition())
782+
then result = getTranslatedStmt(for).(TranslatedForStmt).getCondition().getFirstInstruction()
783+
else result = getTranslatedStmt(for).(TranslatedForStmt).getBody().getFirstInstruction()
787784
}
788785

789786
class TranslatedGotoLabelStmt extends TranslatedSpecificJump {

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
2-
* Contains an abstract class that serves as a Base for classes that deal with the translation of calls
3-
* (both AST generated and compiler generated).
4-
*/
2+
* Contains an abstract class that serves as a Base for classes that deal with the translation of calls
3+
* (both AST generated and compiler generated).
4+
*/
55

66
import csharp
77
private import semmle.code.csharp.ir.implementation.Opcode
@@ -14,7 +14,7 @@ private import semmle.code.csharp.ir.internal.IRCSharpLanguage as Language
1414
private import TranslatedExprBase
1515

1616
abstract class TranslatedCallBase extends TranslatedElement {
17-
override final TranslatedElement getChild(int id) {
17+
final override TranslatedElement getChild(int id) {
1818
// We choose the child's id in the order of evaluation.
1919
// Note: some calls do need qualifiers, though instructions for them have already
2020
// been generated; eg. a constructor does not need to generate a qualifier,
@@ -174,9 +174,7 @@ abstract class TranslatedCallBase extends TranslatedElement {
174174
/**
175175
* Holds if the call has any arguments, not counting the `this` argument.
176176
*/
177-
final predicate hasArguments() {
178-
exists(getArgument(0))
179-
}
177+
final predicate hasArguments() { exists(getArgument(0)) }
180178

181179
predicate hasReadSideEffect() { any() }
182180

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Contains an abstract class that serves as a Base for classes that deal with the translation of exprs
2+
* Contains an abstract class that serves as a Base for classes that deal with the translation of exprs
33
* (both AST generated and compiler generated).
44
*/
55

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ predicate hasPositionalArgIndex(int argIndex) {
7676
// correct number of parameters; it is an overestimation,
7777
// since we don't care about all the callables, so it
7878
// should be restricted more
79-
argIndex in [0..any(CSharp::Callable c).getNumberOfParameters() - 1]
79+
argIndex in [0 .. any(CSharp::Callable c).getNumberOfParameters() - 1]
8080
}
8181

8282
predicate hasAsmOperandIndex(int operandIndex) { none() }

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ Type getVariableType(Variable v) {
99
exists(Type declaredType |
1010
declaredType = v.getType() and
1111
if v instanceof Parameter
12-
then
13-
result = declaredType
12+
then result = declaredType
1413
else
1514
if declaredType instanceof ArrayType
1615
then
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import csharp
22
private import semmle.code.csharp.controlflow.Guards
33

4-
query predicate emptinessCheck(Expr check, CollectionExpr collection, AbstractValue v, boolean isEmpty) {
4+
query predicate emptinessCheck(
5+
Expr check, CollectionExpr collection, AbstractValue v, boolean isEmpty
6+
) {
57
check = collection.getAnEmptinessCheck(v, isEmpty)
68
}

0 commit comments

Comments
 (0)