Skip to content

Commit 2d457e1

Browse files
committed
Swift: autoformat for CFG library
1 parent 86f59a1 commit 2d457e1

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

swift/ql/lib/codeql/swift/controlflow/BasicBlocks.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ private module Cached {
133133
private predicate predBB(BasicBlock succ, BasicBlock pred) { succBB(pred, succ) }
134134

135135
/** Holds if `bb` is an exit basic block that represents normal exit. */
136-
private predicate normalExitBB(BasicBlock bb) { bb.getANode().(Impl::AnnotatedExitNode).isNormal() }
136+
private predicate normalExitBB(BasicBlock bb) {
137+
bb.getANode().(Impl::AnnotatedExitNode).isNormal()
138+
}
137139

138140
/** Holds if `dom` is an immediate post-dominator of `bb`. */
139141
cached
@@ -167,7 +169,9 @@ private predicate entryBB(BasicBlock bb) { bb.getFirstNode() instanceof EntryNod
167169
class EntryBasicBlock extends BasicBlock {
168170
EntryBasicBlock() { entryBB(this) }
169171

170-
override CfgScope getScope() { this.getFirstNode() = any(EntryNode node | node.getScope() = result) }
172+
override CfgScope getScope() {
173+
this.getFirstNode() = any(EntryNode node | node.getScope() = result)
174+
}
171175
}
172176

173177
/**

swift/ql/lib/codeql/swift/controlflow/CfgNodes.qll

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ class PatternCfgNode extends CfgNode {
6363
class PropertyGetterCfgNode extends CfgNode {
6464
PropertyGetterElement n;
6565

66-
PropertyGetterCfgNode() {
67-
n = this.getAstNode()
68-
}
66+
PropertyGetterCfgNode() { n = this.getAstNode() }
6967

7068
Expr getRef() { result = n.getRef() }
7169

@@ -78,9 +76,8 @@ class PropertyGetterCfgNode extends CfgNode {
7876
class PropertySetterCfgNode extends CfgNode {
7977
PropertySetterElement n;
8078

81-
PropertySetterCfgNode() {
82-
n = this.getAstNode()
83-
}
79+
PropertySetterCfgNode() { n = this.getAstNode() }
80+
8481
AssignExpr getAssignExpr() { result = n.getAssignExpr() }
8582

8683
CfgNode getBase() { result.getAst() = n.getBase() }
@@ -93,9 +90,8 @@ class PropertySetterCfgNode extends CfgNode {
9390
class PropertyObserverCfgNode extends CfgNode {
9491
PropertyObserverElement n;
9592

96-
PropertyObserverCfgNode() {
97-
n = this.getAstNode()
98-
}
93+
PropertyObserverCfgNode() { n = this.getAstNode() }
94+
9995
AssignExpr getAssignExpr() { result = n.getAssignExpr() }
10096

10197
CfgNode getBase() { result.getAst() = n.getBase() }
@@ -147,4 +143,4 @@ class EntryNode = Impl::EntryNode;
147143

148144
class ExitNode = Impl::ExitNode;
149145

150-
class AnnotatedExitNode = Impl::AnnotatedExitNode;
146+
class AnnotatedExitNode = Impl::AnnotatedExitNode;

swift/ql/lib/codeql/swift/controlflow/ControlFlowGraph.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class CfgScope extends Scope instanceof CfgScope::Range_ {
2828
* Only nodes that can be reached from an entry point are included in the CFG.
2929
*/
3030
class ControlFlowNode extends Node {
31-
3231
/** Gets the AST node that this node corresponds to, if any. */
3332
ControlFlowElement getNode() { none() }
3433

swift/ql/lib/codeql/swift/controlflow/internal/ControlFlowGraphParameter.qll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/**
22
* Provides the `CfgImpl` module that is used to construct the basic successor relation on control
33
* flow elements, and the `CfgInput` module that is used to construct `CgfImpl`.
4-
*
4+
*
55
* See `ControlFlowGraphImpl.qll` for the auxiliary classes and predicates that map AST elements to
66
* control flow elements and sequence their children.
77
*/
8+
89
import swift
910
import codeql.controlflow.Cfg
1011
import codeql.util.Unit
@@ -52,7 +53,7 @@ module CfgInput implements InputSig<Location> {
5253
predicate isAbnormalExitType(SuccessorType t) {
5354
t instanceof Cfg::SuccessorTypes::ExceptionSuccessor
5455
}
55-
56+
5657
/** Hold if `t` represents a conditional successor type. */
5758
predicate successorTypeIsCondition(SuccessorType t) {
5859
t instanceof Cfg::SuccessorTypes::BooleanSuccessor or
@@ -73,4 +74,4 @@ module CfgInput implements InputSig<Location> {
7374
}
7475
}
7576

76-
module CfgImpl = Make<Location, CfgInput>;
77+
module CfgImpl = Make<Location, CfgInput>;

swift/ql/lib/codeql/swift/controlflow/internal/Splitting.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ private module ConditionalCompletionSplitting {
4646
override string toString() { result = "ConditionalCompletion" }
4747
}
4848

49-
private class ConditionalCompletionSplitImpl extends SplitImpl instanceof ConditionalCompletionSplit {
49+
private class ConditionalCompletionSplitImpl extends SplitImpl instanceof ConditionalCompletionSplit
50+
{
5051
override ConditionalCompletionSplitKind getKind() { any() }
5152

5253
override predicate hasEntry(ControlFlowElement pred, ControlFlowElement succ, Completion c) {

0 commit comments

Comments
 (0)