Skip to content

Commit ecb5708

Browse files
committed
Swift: fix static assert?
1 parent 6a08b8d commit ecb5708

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

swift/codegen/schema.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Callable:
8989
body: BraceStmt?
9090

9191
ConditionElement:
92-
_extends: Locatable
92+
_extends: AstNode
9393
_children:
9494
boolean: Expr?
9595
pattern: Pattern?

swift/ql/lib/codeql/swift/generated/ParentChild.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3298,17 +3298,17 @@ private module Impl {
32983298
private Element getImmediateChildOfConditionElement(
32993299
ConditionElement e, int index, string partialPredicateCall
33003300
) {
3301-
exists(int b, int bLocatable, int n, int nBoolean, int nPattern, int nInitializer |
3301+
exists(int b, int bAstNode, int n, int nBoolean, int nPattern, int nInitializer |
33023302
b = 0 and
3303-
bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and
3304-
n = bLocatable and
3303+
bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and
3304+
n = bAstNode and
33053305
nBoolean = n + 1 and
33063306
nPattern = nBoolean + 1 and
33073307
nInitializer = nPattern + 1 and
33083308
(
33093309
none()
33103310
or
3311-
result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall)
3311+
result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall)
33123312
or
33133313
index = n and result = e.getImmediateBoolean() and partialPredicateCall = "Boolean()"
33143314
or

swift/ql/lib/codeql/swift/generated/Raw.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ module Raw {
10301030
Expr getGuard() { case_label_item_guards(this, result) }
10311031
}
10321032

1033-
class ConditionElement extends @condition_element, Locatable {
1033+
class ConditionElement extends @condition_element, AstNode {
10341034
override string toString() { result = "ConditionElement" }
10351035

10361036
Expr getBoolean() { condition_element_booleans(this, result) }

swift/ql/lib/codeql/swift/generated/Synth.qll

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,14 @@ module Synth {
314314
TWeakStorageType(Raw::WeakStorageType id) { constructWeakStorageType(id) }
315315

316316
class TAstNode =
317-
TCaseLabelItem or TDecl or TExpr or TPattern or TStmt or TStmtCondition or TTypeRepr;
317+
TCaseLabelItem or TConditionElement or TDecl or TExpr or TPattern or TStmt or TStmtCondition or
318+
TTypeRepr;
318319

319320
class TCallable = TAbstractClosureExpr or TAbstractFunctionDecl;
320321

321322
class TFile = TDbFile or TUnknownFile;
322323

323-
class TLocatable = TArgument or TAstNode or TComment or TConditionElement;
324+
class TLocatable = TArgument or TAstNode or TComment;
324325

325326
class TLocation = TDbLocation or TUnknownLocation;
326327

@@ -1408,6 +1409,8 @@ module Synth {
14081409
TAstNode convertAstNodeFromRaw(Raw::Element e) {
14091410
result = convertCaseLabelItemFromRaw(e)
14101411
or
1412+
result = convertConditionElementFromRaw(e)
1413+
or
14111414
result = convertDeclFromRaw(e)
14121415
or
14131416
result = convertExprFromRaw(e)
@@ -1461,8 +1464,6 @@ module Synth {
14611464
result = convertAstNodeFromRaw(e)
14621465
or
14631466
result = convertCommentFromRaw(e)
1464-
or
1465-
result = convertConditionElementFromRaw(e)
14661467
}
14671468

14681469
cached
@@ -3106,6 +3107,8 @@ module Synth {
31063107
Raw::Element convertAstNodeToRaw(TAstNode e) {
31073108
result = convertCaseLabelItemToRaw(e)
31083109
or
3110+
result = convertConditionElementToRaw(e)
3111+
or
31093112
result = convertDeclToRaw(e)
31103113
or
31113114
result = convertExprToRaw(e)
@@ -3159,8 +3162,6 @@ module Synth {
31593162
result = convertAstNodeToRaw(e)
31603163
or
31613164
result = convertCommentToRaw(e)
3162-
or
3163-
result = convertConditionElementToRaw(e)
31643165
}
31653166

31663167
cached

swift/ql/lib/codeql/swift/generated/stmt/ConditionElement.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// generated by codegen/codegen.py
22
private import codeql.swift.generated.Synth
33
private import codeql.swift.generated.Raw
4+
import codeql.swift.elements.AstNode
45
import codeql.swift.elements.expr.Expr
5-
import codeql.swift.elements.Locatable
66
import codeql.swift.elements.pattern.Pattern
77

8-
class ConditionElementBase extends Synth::TConditionElement, Locatable {
8+
class ConditionElementBase extends Synth::TConditionElement, AstNode {
99
override string getAPrimaryQlClass() { result = "ConditionElement" }
1010

1111
Expr getImmediateBoolean() {

swift/ql/lib/swift.dbscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ files(
6666
@argument
6767
| @ast_node
6868
| @comment
69-
| @condition_element
7069
;
7170

7271
#keyset[id]
@@ -103,6 +102,7 @@ locations(
103102

104103
@ast_node =
105104
@case_label_item
105+
| @condition_element
106106
| @decl
107107
| @expr
108108
| @pattern

0 commit comments

Comments
 (0)