Skip to content

Commit 9e4cdbc

Browse files
committed
Merge branch 'main' into redsun82/rust-item-reorg
2 parents 4799861 + 15aa0bb commit 9e4cdbc

File tree

680 files changed

+39270
-14011
lines changed

Some content is hidden

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

680 files changed

+39270
-14011
lines changed

.github/copilot-instructions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
When reviewing code:
2+
* do not review changes in files with `.expected` extension (they are automatically ensured to be correct).
3+
* in `.ql` and `.qll` files, do not try to review the code itself as you don't understand the programming language
4+
well enough to make comments in these languages. You can still check for typos or comment improvements.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Check overlay annotations
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'rc/*'
8+
pull_request:
9+
branches:
10+
- main
11+
- 'rc/*'
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
sync:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Check overlay annotations
22+
run: python config/add-overlay-annotations.py --check java
23+

.github/workflows/ql-for-ql-dataset_measure.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- name: Create database
5454
run: |
5555
"${CODEQL}" database create \
56-
--search-path "${{ github.workspace }}"
56+
--search-path "${{ github.workspace }}" \
5757
--threads 4 \
5858
--language ql --source-root "${{ github.workspace }}/repo" \
5959
"${{ runner.temp }}/database"
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
class Accessible extends @accessible {
2+
string toString() { none() }
3+
}
4+
5+
class Container extends @container {
6+
string toString() { none() }
7+
}
8+
9+
class Expr extends @expr {
10+
string toString() { none() }
11+
}
12+
13+
class Initialiser extends @initialiser {
14+
string toString() { none() }
15+
}
16+
17+
class Location extends @location_default {
18+
string toString() { none() }
19+
}
20+
21+
class Stmt extends @stmt {
22+
string toString() { none() }
23+
}
24+
25+
predicate isLocationDefault(Location l) {
26+
diagnostics(_, _, _, _, _, l)
27+
or
28+
macroinvocations(_, _, l, _)
29+
or
30+
fun_decls(_, _, _, _, l)
31+
or
32+
var_decls(_, _, _, _, l)
33+
or
34+
type_decls(_, _, l)
35+
or
36+
namespace_decls(_, _, l, _)
37+
or
38+
namespace_decls(_, _, _, l)
39+
or
40+
usings(_, _, l, _)
41+
or
42+
static_asserts(_, _, _, l, _)
43+
or
44+
enumconstants(_, _, _, _, _, l)
45+
or
46+
concept_templates(_, _, l)
47+
or
48+
attributes(_, _, _, _, l)
49+
or
50+
attribute_args(_, _, _, _, l)
51+
or
52+
derivations(_, _, _, _, l)
53+
or
54+
frienddecls(_, _, _, l)
55+
or
56+
comments(_, _, l)
57+
or
58+
namequalifiers(_, _, _, l)
59+
or
60+
lambda_capture(_, _, _, _, _, _, l)
61+
or
62+
preprocdirects(_, _, l)
63+
or
64+
xmllocations(_, l)
65+
or
66+
locations_default(l, _, 0, 0, 0, 0) // For containers.
67+
}
68+
69+
predicate isLocationExpr(Location l) {
70+
initialisers(_, _, _, l)
71+
or
72+
exprs(_, _, l)
73+
}
74+
75+
predicate isLocationStmt(Location l) { stmts(_, _, l) }
76+
77+
newtype TExprOrStmtLocation =
78+
TExprLocation(Location l, Container c, int startLine, int startColumn, int endLine, int endColumn) {
79+
isLocationExpr(l) and
80+
(isLocationDefault(l) or isLocationStmt(l)) and
81+
locations_default(l, c, startLine, startColumn, endLine, endColumn)
82+
} or
83+
TStmtLocation(Location l, Container c, int startLine, int startColumn, int endLine, int endColumn) {
84+
isLocationStmt(l) and
85+
(isLocationDefault(l) or isLocationExpr(l)) and
86+
locations_default(l, c, startLine, startColumn, endLine, endColumn)
87+
}
88+
89+
module Fresh = QlBuiltins::NewEntity<TExprOrStmtLocation>;
90+
91+
class NewLocationBase = @location_default or Fresh::EntityId;
92+
93+
class NewLocation extends NewLocationBase {
94+
string toString() { none() }
95+
}
96+
97+
query predicate new_locations_default(
98+
NewLocation l, Container c, int startLine, int startColumn, int endLine, int endColumn
99+
) {
100+
isLocationDefault(l) and
101+
locations_default(l, c, startLine, startColumn, endLine, endColumn)
102+
}
103+
104+
query predicate new_locations_expr(
105+
NewLocation l, Container c, int startLine, int startColumn, int endLine, int endColumn
106+
) {
107+
exists(Location l_old |
108+
isLocationExpr(l_old) and
109+
locations_default(l_old, c, startLine, startColumn, endLine, endColumn)
110+
|
111+
if not isLocationDefault(l_old) and not isLocationStmt(l)
112+
then l = l_old
113+
else l = Fresh::map(TExprLocation(l_old, c, startLine, startColumn, endLine, endColumn))
114+
)
115+
}
116+
117+
query predicate new_locations_stmt(
118+
NewLocation l, Container c, int startLine, int startColumn, int endLine, int endColumn
119+
) {
120+
exists(Location l_old |
121+
isLocationStmt(l_old) and
122+
locations_default(l_old, c, startLine, startColumn, endLine, endColumn)
123+
|
124+
if not isLocationDefault(l_old) and not isLocationExpr(l)
125+
then l = l_old
126+
else l = Fresh::map(TStmtLocation(l_old, c, startLine, startColumn, endLine, endColumn))
127+
)
128+
}
129+
130+
query predicate new_exprs(Expr e, int kind, NewLocation l) {
131+
exists(Location l_old, Container c, int startLine, int startColumn, int endLine, int endColumn |
132+
exprs(e, kind, l_old) and
133+
locations_default(l_old, c, startLine, startColumn, endLine, endColumn)
134+
|
135+
if not isLocationDefault(l_old) and not isLocationStmt(l)
136+
then l = l_old
137+
else l = Fresh::map(TExprLocation(l_old, c, startLine, startColumn, endLine, endColumn))
138+
)
139+
}
140+
141+
query predicate new_initialisers(Initialiser i, Accessible v, Expr e, NewLocation l) {
142+
exists(Location l_old, Container c, int startLine, int startColumn, int endLine, int endColumn |
143+
initialisers(i, v, e, l_old) and
144+
locations_default(l_old, c, startLine, startColumn, endLine, endColumn)
145+
|
146+
if not isLocationDefault(l_old) and not isLocationStmt(l)
147+
then l = l_old
148+
else l = Fresh::map(TExprLocation(l_old, c, startLine, startColumn, endLine, endColumn))
149+
)
150+
}
151+
152+
query predicate new_stmts(Stmt s, int kind, NewLocation l) {
153+
exists(Location l_old, Container c, int startLine, int startColumn, int endLine, int endColumn |
154+
stmts(s, kind, l_old) and
155+
locations_default(l_old, c, startLine, startColumn, endLine, endColumn)
156+
|
157+
if not isLocationDefault(l_old) and not isLocationExpr(l)
158+
then l = l_old
159+
else l = Fresh::map(TStmtLocation(l_old, c, startLine, startColumn, endLine, endColumn))
160+
)
161+
}

0 commit comments

Comments
 (0)