Skip to content

Commit d1160f8

Browse files
committed
C++: Autoformat for named destructors in IR
1 parent 1b571f8 commit d1160f8

File tree

6 files changed

+25
-10
lines changed

6 files changed

+25
-10
lines changed

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ CppType getInstructionOperandType(Instruction instruction, TypedOperandTag tag)
261261
Instruction getPhiInstructionBlockStart(PhiInstruction instr) { none() }
262262

263263
Instruction getInstructionSuccessor(Instruction instruction, EdgeKind kind) {
264-
result =
264+
result =
265265
getInstructionTranslatedElement(instruction)
266266
.getInstructionSuccessor(getInstructionTag(instruction), kind)
267267
}

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,9 @@ private int initializeAllocationGroup() { result = 3 }
447447
abstract class TranslatedSideEffect extends TranslatedElement {
448448
final override TranslatedElement getChild(int n) { none() }
449449

450-
final override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) { none() }
450+
final override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
451+
none()
452+
}
451453

452454
final override Instruction getFirstInstruction(EdgeKind kind) {
453455
result = this.getInstruction(OnlyInstructionTag()) and

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCondition.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ abstract class TranslatedFlexibleCondition extends TranslatedCondition, Conditio
7070
none()
7171
}
7272

73-
final override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) { none() }
73+
final override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
74+
none()
75+
}
7476

7577
abstract TranslatedCondition getOperand();
7678
}
@@ -96,7 +98,9 @@ class TranslatedParenthesisCondition extends TranslatedFlexibleCondition {
9698
abstract class TranslatedNativeCondition extends TranslatedCondition, TTranslatedNativeCondition {
9799
TranslatedNativeCondition() { this = TTranslatedNativeCondition(expr) }
98100

99-
final override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) { none() }
101+
final override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
102+
none()
103+
}
100104
}
101105

102106
abstract class TranslatedBinaryLogicalOperation extends TranslatedNativeCondition, ConditionContext {

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,9 @@ abstract class TranslatedParameter extends TranslatedElement {
407407
result = this.getParent().getChildSuccessor(this, kind)
408408
}
409409

410-
final override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) { none() }
410+
final override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
411+
none()
412+
}
411413

412414
final override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) {
413415
tag = InitializerVariableAddressTag() and
@@ -762,7 +764,7 @@ class TranslatedReadEffects extends TranslatedElement, TTranslatedReadEffects {
762764
.getFirstInstruction(any(GotoEdge goto))
763765
else result = this.getParent().getChildSuccessor(this, any(GotoEdge goto))
764766
}
765-
767+
766768
override TranslatedElement getLastChild() {
767769
result = this.getChild(max(int id | exists(this.getChild(id))))
768770
}

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ class TranslatedStaticStorageDurationVarInit extends TranslatedRootElement,
2727
kind instanceof GotoEdge
2828
}
2929

30-
override Instruction getALastInstructionInternal() { result = this.getInstruction(ExitFunctionTag()) }
30+
override Instruction getALastInstructionInternal() {
31+
result = this.getInstruction(ExitFunctionTag())
32+
}
3133

3234
override TranslatedElement getChild(int n) {
3335
n = 1 and

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,9 @@ class TranslatedExprStmt extends TranslatedStmt {
384384
result = this.getExpr().getFirstInstruction(kind)
385385
}
386386

387-
override Instruction getALastInstructionInternal() { result = this.getExpr().getALastInstruction() }
387+
override Instruction getALastInstructionInternal() {
388+
result = this.getExpr().getALastInstruction()
389+
}
388390

389391
override TranslatedElement getLastChild() { result = this.getExpr() }
390392

@@ -997,7 +999,8 @@ class TranslatedForStmt extends TranslatedLoop {
997999
child = this.getUpdate() and result = this.getFirstConditionInstruction(kind)
9981000
or
9991001
exists(int lastDestructorIndex |
1000-
lastDestructorIndex = max(int n | exists(this.getChild(n)) and n >= this.getFirstDestructorCallIndex()) and
1002+
lastDestructorIndex =
1003+
max(int n | exists(this.getChild(n)) and n >= this.getFirstDestructorCallIndex()) and
10011004
child = this.getChild(lastDestructorIndex) and
10021005
result = this.getParent().getChildSuccessor(this, kind)
10031006
)
@@ -1162,7 +1165,9 @@ class TranslatedSwitchStmt extends TranslatedStmt {
11621165
else result = this.getFirstExprInstruction(kind)
11631166
}
11641167

1165-
override Instruction getALastInstructionInternal() { result = this.getBody().getALastInstruction() }
1168+
override Instruction getALastInstructionInternal() {
1169+
result = this.getBody().getALastInstruction()
1170+
}
11661171

11671172
override TranslatedElement getLastChild() { result = this.getBody() }
11681173

0 commit comments

Comments
 (0)