Skip to content

Commit 9f59e38

Browse files
committed
C#: Autoformat
1 parent c642e72 commit 9f59e38

49 files changed

Lines changed: 3074 additions & 4350 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

csharp/ql/src/semmle/code/csharp/Namespace.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ class Namespace extends DotNet::Namespace, TypeContainer, Declaration, @namespac
120120

121121
override string toString() { result = DotNet::Namespace.super.toString() }
122122

123-
override predicate hasQualifiedName(string a, string b) { DotNet::Namespace.super.hasQualifiedName(a, b) }
123+
override predicate hasQualifiedName(string a, string b) {
124+
DotNet::Namespace.super.hasQualifiedName(a, b)
125+
}
124126
}
125127

126128
/**

csharp/ql/src/semmle/code/csharp/dataflow/SSA.qll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,9 +1115,7 @@ module Ssa {
11151115
}
11161116

11171117
/** Gets a run-time target for the delegate call `c`. */
1118-
Callable getARuntimeDelegateTarget(Call c) {
1119-
delegateCall(c, delegateCallSource(result))
1120-
}
1118+
Callable getARuntimeDelegateTarget(Call c) { delegateCall(c, delegateCallSource(result)) }
11211119
}
11221120

11231121
/** Holds if `(c1,c2)` is an edge in the call graph. */

csharp/ql/src/semmle/code/csharp/exprs/Call.qll

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,7 @@ class ConstructorInitializer extends Call, @constructor_init_expr {
425425
* }
426426
* ```
427427
*/
428-
predicate isThis() {
429-
this.getTargetType() = this.getConstructorType()
430-
}
428+
predicate isThis() { this.getTargetType() = this.getConstructorType() }
431429

432430
/**
433431
* Holds if this initialier is a `base` initializer, for example `base(0)`
@@ -445,9 +443,7 @@ class ConstructorInitializer extends Call, @constructor_init_expr {
445443
* }
446444
* ```
447445
*/
448-
predicate isBase() {
449-
this.getTargetType() != this.getConstructorType()
450-
}
446+
predicate isBase() { this.getTargetType() != this.getConstructorType() }
451447

452448
/**
453449
* Gets the constructor that this initializer call belongs to. For example,

csharp/ql/src/semmle/code/csharp/ir/IR.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
* Most queries should operate on the aliased SSA IR, so that's what we expose
33
* publicly as the "IR".
44
*/
5-
import implementation.raw.IR
5+
6+
import implementation.raw.IR

csharp/ql/src/semmle/code/csharp/ir/IRConfiguration.qll

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@ private newtype TIRConfiguration = MkIRConfiguration()
1010
* The query can extend this class to control which functions have IR generated for them.
1111
*/
1212
class IRConfiguration extends TIRConfiguration {
13-
string toString() {
14-
result = "IRConfiguration"
15-
}
13+
string toString() { result = "IRConfiguration" }
1614

1715
/**
1816
* Holds if IR should be created for callable `callable`. By default, holds for all callables.
1917
*/
20-
predicate shouldCreateIRForFunction(Callable callable) {
21-
any()
22-
}
18+
predicate shouldCreateIRForFunction(Callable callable) { any() }
2319
}

csharp/ql/src/semmle/code/csharp/ir/IRSanity.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @name IR Sanity Check
3-
* @description Performs sanity checks on the Intermediate Representation. This query should have no results.
3+
* @description Performs sanity checks on the Intermediate Representation. This query should have no results.
44
* @kind table
55
* @id csharp/ir-sanity-check
66
*/
Lines changed: 26 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
private import internal.EdgeKindInternal
22

33
private newtype TEdgeKind =
4-
TGotoEdge() or // Single successor (including fall-through)
5-
TTrueEdge() or // 'true' edge of conditional branch
6-
TFalseEdge() or // 'false' edge of conditional branch
7-
TExceptionEdge() or // Thrown exception
8-
TDefaultEdge() or // 'default' label of switch
9-
TCaseEdge(string minValue, string maxValue) { // Case label of switch
4+
TGotoEdge() or // Single successor (including fall-through)
5+
TTrueEdge() or // 'true' edge of conditional branch
6+
TFalseEdge() or // 'false' edge of conditional branch
7+
TExceptionEdge() or // Thrown exception
8+
TDefaultEdge() or // 'default' label of switch
9+
TCaseEdge(string minValue, string maxValue) {
10+
// Case label of switch
1011
Language::hasCaseEdge(minValue, maxValue)
1112
}
1213

@@ -24,99 +25,71 @@ abstract class EdgeKind extends TEdgeKind {
2425
* or `IRBlock`.
2526
*/
2627
class GotoEdge extends EdgeKind, TGotoEdge {
27-
override final string toString() {
28-
result = "Goto"
29-
}
28+
final override string toString() { result = "Goto" }
3029
}
3130

32-
GotoEdge gotoEdge() {
33-
result = TGotoEdge()
34-
}
31+
GotoEdge gotoEdge() { result = TGotoEdge() }
3532

3633
/**
3734
* A "true" edge, representing the successor of a conditional branch when the
3835
* condition is non-zero.
3936
*/
4037
class TrueEdge extends EdgeKind, TTrueEdge {
41-
override final string toString() {
42-
result = "True"
43-
}
38+
final override string toString() { result = "True" }
4439
}
4540

46-
TrueEdge trueEdge() {
47-
result = TTrueEdge()
48-
}
41+
TrueEdge trueEdge() { result = TTrueEdge() }
4942

5043
/**
5144
* A "false" edge, representing the successor of a conditional branch when the
5245
* condition is zero.
5346
*/
5447
class FalseEdge extends EdgeKind, TFalseEdge {
55-
override final string toString() {
56-
result = "False"
57-
}
48+
final override string toString() { result = "False" }
5849
}
5950

60-
FalseEdge falseEdge() {
61-
result = TFalseEdge()
62-
}
51+
FalseEdge falseEdge() { result = TFalseEdge() }
6352

6453
/**
6554
* An "exception" edge, representing the successor of an instruction when that
6655
* instruction's evaluation throws an exception.
6756
*/
6857
class ExceptionEdge extends EdgeKind, TExceptionEdge {
69-
override final string toString() {
70-
result = "Exception"
71-
}
58+
final override string toString() { result = "Exception" }
7259
}
7360

74-
ExceptionEdge exceptionEdge() {
75-
result = TExceptionEdge()
76-
}
61+
ExceptionEdge exceptionEdge() { result = TExceptionEdge() }
7762

7863
/**
7964
* A "default" edge, representing the successor of a `Switch` instruction when
8065
* none of the case values matches the condition value.
8166
*/
8267
class DefaultEdge extends EdgeKind, TDefaultEdge {
83-
override final string toString() {
84-
result = "Default"
85-
}
68+
final override string toString() { result = "Default" }
8669
}
8770

88-
DefaultEdge defaultEdge() {
89-
result = TDefaultEdge()
90-
}
71+
DefaultEdge defaultEdge() { result = TDefaultEdge() }
9172

9273
/**
9374
* A "case" edge, representing the successor of a `Switch` instruction when the
9475
* the condition value matches a correponding `case` label.
9576
*/
9677
class CaseEdge extends EdgeKind, TCaseEdge {
9778
string minValue;
79+
9880
string maxValue;
9981

100-
CaseEdge() {
101-
this = TCaseEdge(minValue, maxValue)
102-
}
82+
CaseEdge() { this = TCaseEdge(minValue, maxValue) }
10383

104-
override final string toString() {
105-
if minValue = maxValue then
106-
result = "Case[" + minValue + "]"
107-
else
108-
result = "Case[" + minValue + ".." + maxValue + "]"
84+
final override string toString() {
85+
if minValue = maxValue
86+
then result = "Case[" + minValue + "]"
87+
else result = "Case[" + minValue + ".." + maxValue + "]"
10988
}
11089

111-
string getMinValue() {
112-
result = minValue
113-
}
90+
string getMinValue() { result = minValue }
11491

115-
string getMaxValue() {
116-
result = maxValue
117-
}
92+
string getMaxValue() { result = maxValue }
11893
}
11994

120-
CaseEdge caseEdge(string minValue, string maxValue) {
121-
result = TCaseEdge(minValue, maxValue)
122-
}
95+
CaseEdge caseEdge(string minValue, string maxValue) { result = TCaseEdge(minValue, maxValue) }

csharp/ql/src/semmle/code/csharp/ir/implementation/IRConfiguration.qll

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@ private newtype TIRConfiguration = MkIRConfiguration()
1010
* The query can extend this class to control which functions have IR generated for them.
1111
*/
1212
class IRConfiguration extends TIRConfiguration {
13-
string toString() {
14-
result = "IRConfiguration"
15-
}
13+
string toString() { result = "IRConfiguration" }
1614

1715
/**
1816
* Holds if IR should be created for function `func`. By default, holds for all functions.
1917
*/
20-
predicate shouldCreateIRForFunction(Language::Function func) {
21-
any()
22-
}
18+
predicate shouldCreateIRForFunction(Language::Function func) { any() }
2319
}

csharp/ql/src/semmle/code/csharp/ir/implementation/MemoryAccessKind.qll

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -15,45 +15,33 @@ private newtype TMemoryAccessKind =
1515
* memory result.
1616
*/
1717
class MemoryAccessKind extends TMemoryAccessKind {
18-
string toString() {
19-
none()
20-
}
18+
string toString() { none() }
2119

2220
/**
2321
* Holds if the operand or result accesses memory pointed to by the `AddressOperand` on the
2422
* same instruction.
2523
*/
26-
predicate usesAddressOperand() {
27-
none()
28-
}
24+
predicate usesAddressOperand() { none() }
2925
}
3026

3127
/**
3228
* The operand or result accesses memory at the address specified by the `AddressOperand` on the
3329
* same instruction.
3430
*/
3531
class IndirectMemoryAccess extends MemoryAccessKind, TIndirectMemoryAccess {
36-
override string toString() {
37-
result = "indirect"
38-
}
39-
40-
override final predicate usesAddressOperand() {
41-
any()
42-
}
32+
override string toString() { result = "indirect" }
33+
34+
final override predicate usesAddressOperand() { any() }
4335
}
4436

4537
/**
4638
* The operand or result may access some, all, or none of the memory at the address specified by the
4739
* `AddressOperand` on the same instruction.
4840
*/
4941
class IndirectMayMemoryAccess extends MemoryAccessKind, TIndirectMayMemoryAccess {
50-
override string toString() {
51-
result = "indirect(may)"
52-
}
42+
override string toString() { result = "indirect(may)" }
5343

54-
override final predicate usesAddressOperand() {
55-
any()
56-
}
44+
final override predicate usesAddressOperand() { any() }
5745
}
5846

5947
/**
@@ -62,13 +50,9 @@ class IndirectMayMemoryAccess extends MemoryAccessKind, TIndirectMayMemoryAccess
6250
* `BufferSizeOperand`.
6351
*/
6452
class BufferMemoryAccess extends MemoryAccessKind, TBufferMemoryAccess {
65-
override string toString() {
66-
result = "buffer"
67-
}
53+
override string toString() { result = "buffer" }
6854

69-
override final predicate usesAddressOperand() {
70-
any()
71-
}
55+
final override predicate usesAddressOperand() { any() }
7256
}
7357

7458
/**
@@ -77,69 +61,53 @@ class BufferMemoryAccess extends MemoryAccessKind, TBufferMemoryAccess {
7761
* elements given by the `BufferSizeOperand`.
7862
*/
7963
class BufferMayMemoryAccess extends MemoryAccessKind, TBufferMayMemoryAccess {
80-
override string toString() {
81-
result = "buffer(may)"
82-
}
64+
override string toString() { result = "buffer(may)" }
8365

84-
override final predicate usesAddressOperand() {
85-
any()
86-
}
66+
final override predicate usesAddressOperand() { any() }
8767
}
8868

8969
/**
9070
* The operand or result accesses all memory whose address has escaped.
9171
*/
9272
class EscapedMemoryAccess extends MemoryAccessKind, TEscapedMemoryAccess {
93-
override string toString() {
94-
result = "escaped"
95-
}
73+
override string toString() { result = "escaped" }
9674
}
9775

9876
/**
9977
* The operand or result may access all memory whose address has escaped.
10078
*/
10179
class EscapedMayMemoryAccess extends MemoryAccessKind, TEscapedMayMemoryAccess {
102-
override string toString() {
103-
result = "escaped(may)"
104-
}
80+
override string toString() { result = "escaped(may)" }
10581
}
10682

10783
/**
10884
* The operand is a Phi operand, which accesses the same memory as its
10985
* definition.
11086
*/
11187
class PhiMemoryAccess extends MemoryAccessKind, TPhiMemoryAccess {
112-
override string toString() {
113-
result = "phi"
114-
}
88+
override string toString() { result = "phi" }
11589
}
11690

11791
/**
11892
* The operand is a ChiTotal operand, which accesses the same memory as its
11993
* definition.
12094
*/
12195
class ChiTotalMemoryAccess extends MemoryAccessKind, TChiTotalMemoryAccess {
122-
override string toString() {
123-
result = "chi(total)"
124-
}
96+
override string toString() { result = "chi(total)" }
12597
}
12698

12799
/**
128100
* The operand is a ChiPartial operand, which accesses the same memory as its
129101
* definition.
130102
*/
131103
class ChiPartialMemoryAccess extends MemoryAccessKind, TChiPartialMemoryAccess {
132-
override string toString() {
133-
result = "chi(partial)"
134-
}
104+
override string toString() { result = "chi(partial)" }
135105
}
136106

137107
/**
138108
* The operand accesses memory not modeled in SSA. Used only on the result of
139109
* `UnmodeledDefinition` and on the operands of `UnmodeledUse`.
140110
*/
141111
class UnmodeledMemoryAccess extends MemoryAccessKind, TUnmodeledMemoryAccess {
142-
override string toString() {
143-
result = "unmodeled"
144-
}
112+
override string toString() { result = "unmodeled" }
145113
}

0 commit comments

Comments
 (0)