Skip to content

Commit 6b79e24

Browse files
committed
Ruby: add overlay[local] annotations to AST/CFG/SSA layers
1 parent 8d16d02 commit 6b79e24

Some content is hidden

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

54 files changed

+152
-17
lines changed

ql/ql/src/codeql/Locations.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/** Provides classes for working with locations. */
2+
overlay[local]
3+
module;
24

35
import files.FileSystem
46

ql/ql/src/codeql/files/FileSystem.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/** Provides classes for working with files and folders. */
2+
overlay[local?]
3+
module;
24

35
private import codeql_ql.ast.internal.TreeSitter
46
private import codeql.Locations

ql/ql/src/codeql_ql/StructuredLogs.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
overlay[local]
2+
module;
3+
14
private import ql
25
private import codeql_ql.ast.internal.TreeSitter
36
private import experimental.RA
@@ -23,6 +26,7 @@ private float stringToTimestamp(string str) {
2326
}
2427

2528
bindingset[s]
29+
overlay[global]
2630
private Predicate getPredicateFromPosition(string s) {
2731
exists(string r, string filepath, int startline | r = "(.*):(\\d+),(\\d+)-(\\d+),(\\d+)" |
2832
filepath = s.regexpCapture(r, 1) and
@@ -397,6 +401,7 @@ module KindPredicatesLog {
397401

398402
string getPosition() { result = this.getString("position") }
399403

404+
overlay[global]
400405
Predicate getPredicate() { result = getPredicateFromPosition(this.getPosition()) }
401406

402407
/**

ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ private predicate discardLocation(@location_default loc) {
2323
)
2424
}
2525

26+
overlay[local]
2627
module QL {
2728
/** The base class for all AST nodes */
2829
class AstNode extends @ql_ast_node {
@@ -67,15 +68,13 @@ module QL {
6768
}
6869

6970
/** Gets the file containing the given `node`. */
70-
overlay[local]
7171
private @file getNodeFile(@ql_ast_node node) {
7272
exists(@location_default loc | ql_ast_node_location(node, loc) |
7373
locations_default(loc, result, _, _, _, _)
7474
)
7575
}
7676

7777
/** Holds if `node` is in the `file` and is part of the overlay base database. */
78-
overlay[local]
7978
private predicate discardableAstNode(@file file, @ql_ast_node node) {
8079
not isOverlay() and file = getNodeFile(node)
8180
}
@@ -1315,6 +1314,7 @@ module QL {
13151314
}
13161315
}
13171316

1317+
overlay[local]
13181318
module Dbscheme {
13191319
/** The base class for all AST nodes */
13201320
class AstNode extends @dbscheme_ast_node {
@@ -1359,15 +1359,13 @@ module Dbscheme {
13591359
}
13601360

13611361
/** Gets the file containing the given `node`. */
1362-
overlay[local]
13631362
private @file getNodeFile(@dbscheme_ast_node node) {
13641363
exists(@location_default loc | dbscheme_ast_node_location(node, loc) |
13651364
locations_default(loc, result, _, _, _, _)
13661365
)
13671366
}
13681367

13691368
/** Holds if `node` is in the `file` and is part of the overlay base database. */
1370-
overlay[local]
13711369
private predicate discardableAstNode(@file file, @dbscheme_ast_node node) {
13721370
not isOverlay() and file = getNodeFile(node)
13731371
}
@@ -1673,6 +1671,7 @@ module Dbscheme {
16731671
}
16741672
}
16751673

1674+
overlay[local]
16761675
module Blame {
16771676
/** The base class for all AST nodes */
16781677
class AstNode extends @blame_ast_node {
@@ -1717,15 +1716,13 @@ module Blame {
17171716
}
17181717

17191718
/** Gets the file containing the given `node`. */
1720-
overlay[local]
17211719
private @file getNodeFile(@blame_ast_node node) {
17221720
exists(@location_default loc | blame_ast_node_location(node, loc) |
17231721
locations_default(loc, result, _, _, _, _)
17241722
)
17251723
}
17261724

17271725
/** Holds if `node` is in the `file` and is part of the overlay base database. */
1728-
overlay[local]
17291726
private predicate discardableAstNode(@file file, @blame_ast_node node) {
17301727
not isOverlay() and file = getNodeFile(node)
17311728
}
@@ -1808,6 +1805,7 @@ module Blame {
18081805
}
18091806
}
18101807

1808+
overlay[local]
18111809
module JSON {
18121810
/** The base class for all AST nodes */
18131811
class AstNode extends @json_ast_node {
@@ -1852,15 +1850,13 @@ module JSON {
18521850
}
18531851

18541852
/** Gets the file containing the given `node`. */
1855-
overlay[local]
18561853
private @file getNodeFile(@json_ast_node node) {
18571854
exists(@location_default loc | json_ast_node_location(node, loc) |
18581855
locations_default(loc, result, _, _, _, _)
18591856
)
18601857
}
18611858

18621859
/** Holds if `node` is in the `file` and is part of the overlay base database. */
1863-
overlay[local]
18641860
private predicate discardableAstNode(@file file, @json_ast_node node) {
18651861
not isOverlay() and file = getNodeFile(node)
18661862
}

ql/ql/src/experimental/RA.qll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
/**
2-
* Parses RA expressions.
3-
*/
1+
overlay[local]
2+
module;
43

54
/**
65
* A predicate that contains RA.

ql/ql/src/queries/performance/LargeTupleSum.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import ql
66
import codeql_ql.StructuredLogs
77
import KindPredicatesLog
88

9+
overlay[local]
910
module SumCounts implements Fold<int> {
1011
int base(PipeLineRun run) { result = sum(int i | | run.getCount(i)) }
1112

ql/ql/test/experimental/raparser.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import experimental.RA
22

3+
overlay[local]
34
class TestPredicate extends string {
45
TestPredicate() { this = "p1" }
56

ruby/ql/lib/codeql/Locations.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/** Provides classes for working with locations. */
2+
overlay[local]
3+
module;
24

35
import files.FileSystem
46

ruby/ql/lib/codeql/files/FileSystem.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/** Provides classes for working with files and folders. */
2+
overlay[local]
3+
module;
24

35
private import codeql.Locations
46
private import codeql.util.FileSystem

ruby/ql/lib/codeql/ruby/AST.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
overlay[local]
2+
module;
3+
14
import codeql.Locations
25
import ast.Call
36
import ast.Control

0 commit comments

Comments
 (0)