Skip to content

Commit 043e5f7

Browse files
C++, C#: Autoformat
1 parent bcd987c commit 043e5f7

File tree

29 files changed

+94
-123
lines changed

29 files changed

+94
-123
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
private import IR
22
import InstructionSanity
3-
import IRTypeSanity
3+
import IRTypeSanity

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRVariable.qll

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,12 @@ abstract class IRVariable extends TIRVariable {
2525
/**
2626
* Gets the type of the variable.
2727
*/
28-
final Language::Type getType() {
29-
getLanguageType().hasType(result, false)
30-
}
28+
final Language::Type getType() { getLanguageType().hasType(result, false) }
3129

3230
/**
3331
* Gets the language-neutral type of the variable.
3432
*/
35-
final IRType getIRType() {
36-
result = getLanguageType().getIRType()
37-
}
33+
final IRType getIRType() { result = getLanguageType().getIRType() }
3834

3935
/**
4036
* Gets the type of the variable.

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,8 @@ module InstructionSanity {
118118
not exists(operand.getType()) and
119119
use = operand.getUse() and
120120
func = use.getEnclosingFunction() and
121-
message = "Operand '" + operand.toString() + "' of instruction '" +
122-
use.getOpcode().toString() + "' missing type in function '" +
123-
Language::getIdentityString(func) + "'."
121+
message = "Operand '" + operand.toString() + "' of instruction '" + use.getOpcode().toString()
122+
+ "' missing type in function '" + Language::getIdentityString(func) + "'."
124123
)
125124
}
126125

@@ -458,7 +457,8 @@ class Instruction extends Construction::TInstruction {
458457
exists(Language::LanguageType resultType |
459458
resultType = getResultLanguageType() and
460459
(
461-
resultType.hasUnspecifiedType(result, _) or
460+
resultType.hasUnspecifiedType(result, _)
461+
or
462462
not resultType.hasUnspecifiedType(_, _) and result instanceof Language::UnknownType
463463
)
464464
)
@@ -482,9 +482,7 @@ class Instruction extends Construction::TInstruction {
482482
* result of the `Load` instruction is a prvalue of type `int`, representing
483483
* the integer value loaded from variable `x`.
484484
*/
485-
final predicate isGLValue() {
486-
Construction::getInstructionResultType(this).hasType(_, true)
487-
}
485+
final predicate isGLValue() { Construction::getInstructionResultType(this).hasType(_, true) }
488486

489487
/**
490488
* Gets the size of the result produced by this instruction, in bytes. If the
@@ -493,9 +491,7 @@ class Instruction extends Construction::TInstruction {
493491
* If `this.isGLValue()` holds for this instruction, the value of
494492
* `getResultSize()` will always be the size of a pointer.
495493
*/
496-
final int getResultSize() {
497-
result = Construction::getInstructionResultType(this).getByteSize()
498-
}
494+
final int getResultSize() { result = Construction::getInstructionResultType(this).getByteSize() }
499495

500496
/**
501497
* Gets the opcode that specifies the operation performed by this instruction.

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/ValueNumbering.qll

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ newtype TValueNumber =
4747
unaryValueNumber(_, irFunc, opcode, type, operand)
4848
} or
4949
TInheritanceConversionValueNumber(
50-
IRFunction irFunc, Opcode opcode, Language::Class baseClass, Language::Class derivedClass, ValueNumber operand
50+
IRFunction irFunc, Opcode opcode, Language::Class baseClass, Language::Class derivedClass,
51+
ValueNumber operand
5152
) {
5253
inheritanceConversionValueNumber(_, irFunc, opcode, baseClass, derivedClass, operand)
5354
} or
@@ -186,8 +187,8 @@ private predicate binaryValueNumber(
186187
}
187188

188189
private predicate pointerArithmeticValueNumber(
189-
PointerArithmeticInstruction instr, IRFunction irFunc, Opcode opcode, IRType type, int elementSize,
190-
ValueNumber leftOperand, ValueNumber rightOperand
190+
PointerArithmeticInstruction instr, IRFunction irFunc, Opcode opcode, IRType type,
191+
int elementSize, ValueNumber leftOperand, ValueNumber rightOperand
191192
) {
192193
instr.getEnclosingIRFunction() = irFunc and
193194
instr.getOpcode() = opcode and
@@ -294,14 +295,16 @@ private ValueNumber nonUniqueValueNumber(Instruction instr) {
294295
result = TUnaryValueNumber(irFunc, opcode, type, operand)
295296
)
296297
or
297-
exists(Opcode opcode, Language::Class baseClass, Language::Class derivedClass,
298-
ValueNumber operand |
298+
exists(
299+
Opcode opcode, Language::Class baseClass, Language::Class derivedClass, ValueNumber operand
300+
|
299301
inheritanceConversionValueNumber(instr, irFunc, opcode, baseClass, derivedClass, operand) and
300302
result = TInheritanceConversionValueNumber(irFunc, opcode, baseClass, derivedClass, operand)
301303
)
302304
or
303305
exists(
304-
Opcode opcode, IRType type, int elementSize, ValueNumber leftOperand, ValueNumber rightOperand
306+
Opcode opcode, IRType type, int elementSize, ValueNumber leftOperand,
307+
ValueNumber rightOperand
305308
|
306309
pointerArithmeticValueNumber(instr, irFunc, opcode, type, elementSize, leftOperand,
307310
rightOperand) and

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/PrintSSA.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,3 @@ class PropertyProvider extends IRPropertyProvider {
143143
)
144144
}
145145
}
146-

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,4 +858,3 @@ private module CachedForDebugging {
858858
result.getTag() = var.getTag()
859859
}
860860
}
861-
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
private import IR
22
import InstructionSanity
3-
import IRTypeSanity
3+
import IRTypeSanity

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/IRVariable.qll

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,12 @@ abstract class IRVariable extends TIRVariable {
2525
/**
2626
* Gets the type of the variable.
2727
*/
28-
final Language::Type getType() {
29-
getLanguageType().hasType(result, false)
30-
}
28+
final Language::Type getType() { getLanguageType().hasType(result, false) }
3129

3230
/**
3331
* Gets the language-neutral type of the variable.
3432
*/
35-
final IRType getIRType() {
36-
result = getLanguageType().getIRType()
37-
}
33+
final IRType getIRType() { result = getLanguageType().getIRType() }
3834

3935
/**
4036
* Gets the type of the variable.

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,8 @@ module InstructionSanity {
118118
not exists(operand.getType()) and
119119
use = operand.getUse() and
120120
func = use.getEnclosingFunction() and
121-
message = "Operand '" + operand.toString() + "' of instruction '" +
122-
use.getOpcode().toString() + "' missing type in function '" +
123-
Language::getIdentityString(func) + "'."
121+
message = "Operand '" + operand.toString() + "' of instruction '" + use.getOpcode().toString()
122+
+ "' missing type in function '" + Language::getIdentityString(func) + "'."
124123
)
125124
}
126125

@@ -458,7 +457,8 @@ class Instruction extends Construction::TInstruction {
458457
exists(Language::LanguageType resultType |
459458
resultType = getResultLanguageType() and
460459
(
461-
resultType.hasUnspecifiedType(result, _) or
460+
resultType.hasUnspecifiedType(result, _)
461+
or
462462
not resultType.hasUnspecifiedType(_, _) and result instanceof Language::UnknownType
463463
)
464464
)
@@ -482,9 +482,7 @@ class Instruction extends Construction::TInstruction {
482482
* result of the `Load` instruction is a prvalue of type `int`, representing
483483
* the integer value loaded from variable `x`.
484484
*/
485-
final predicate isGLValue() {
486-
Construction::getInstructionResultType(this).hasType(_, true)
487-
}
485+
final predicate isGLValue() { Construction::getInstructionResultType(this).hasType(_, true) }
488486

489487
/**
490488
* Gets the size of the result produced by this instruction, in bytes. If the
@@ -493,9 +491,7 @@ class Instruction extends Construction::TInstruction {
493491
* If `this.isGLValue()` holds for this instruction, the value of
494492
* `getResultSize()` will always be the size of a pointer.
495493
*/
496-
final int getResultSize() {
497-
result = Construction::getInstructionResultType(this).getByteSize()
498-
}
494+
final int getResultSize() { result = Construction::getInstructionResultType(this).getByteSize() }
499495

500496
/**
501497
* Gets the opcode that specifies the operation performed by this instruction.

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/gvn/ValueNumbering.qll

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ newtype TValueNumber =
4747
unaryValueNumber(_, irFunc, opcode, type, operand)
4848
} or
4949
TInheritanceConversionValueNumber(
50-
IRFunction irFunc, Opcode opcode, Language::Class baseClass, Language::Class derivedClass, ValueNumber operand
50+
IRFunction irFunc, Opcode opcode, Language::Class baseClass, Language::Class derivedClass,
51+
ValueNumber operand
5152
) {
5253
inheritanceConversionValueNumber(_, irFunc, opcode, baseClass, derivedClass, operand)
5354
} or
@@ -186,8 +187,8 @@ private predicate binaryValueNumber(
186187
}
187188

188189
private predicate pointerArithmeticValueNumber(
189-
PointerArithmeticInstruction instr, IRFunction irFunc, Opcode opcode, IRType type, int elementSize,
190-
ValueNumber leftOperand, ValueNumber rightOperand
190+
PointerArithmeticInstruction instr, IRFunction irFunc, Opcode opcode, IRType type,
191+
int elementSize, ValueNumber leftOperand, ValueNumber rightOperand
191192
) {
192193
instr.getEnclosingIRFunction() = irFunc and
193194
instr.getOpcode() = opcode and
@@ -294,14 +295,16 @@ private ValueNumber nonUniqueValueNumber(Instruction instr) {
294295
result = TUnaryValueNumber(irFunc, opcode, type, operand)
295296
)
296297
or
297-
exists(Opcode opcode, Language::Class baseClass, Language::Class derivedClass,
298-
ValueNumber operand |
298+
exists(
299+
Opcode opcode, Language::Class baseClass, Language::Class derivedClass, ValueNumber operand
300+
|
299301
inheritanceConversionValueNumber(instr, irFunc, opcode, baseClass, derivedClass, operand) and
300302
result = TInheritanceConversionValueNumber(irFunc, opcode, baseClass, derivedClass, operand)
301303
)
302304
or
303305
exists(
304-
Opcode opcode, IRType type, int elementSize, ValueNumber leftOperand, ValueNumber rightOperand
306+
Opcode opcode, IRType type, int elementSize, ValueNumber leftOperand,
307+
ValueNumber rightOperand
305308
|
306309
pointerArithmeticValueNumber(instr, irFunc, opcode, type, elementSize, leftOperand,
307310
rightOperand) and

0 commit comments

Comments
 (0)