Skip to content

Commit 2212440

Browse files
authored
Merge pull request github#13458 from github/alexdenisov/swift-5.8-against-3.10
Swift: upgrade extractor to support Swift 5.8.1
2 parents e8b12ce + c080cba commit 2212440

File tree

36 files changed

+10932
-88
lines changed

36 files changed

+10932
-88
lines changed

swift/BUILD.bazel

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ pkg_runfiles(
6464
prefix = "tools/" + codeql_platform,
6565
)
6666

67+
pkg_filegroup(
68+
name = "resource-dir-arch",
69+
srcs = ["//swift/third_party/swift-llvm-support:swift-resource-dir"],
70+
prefix = "resource-dir/" + codeql_platform,
71+
visibility = ["//visibility:public"],
72+
)
73+
6774
pkg_files(
6875
name = "swift-test-sdk-arch",
6976
srcs = ["//swift/third_party/swift-llvm-support:swift-test-sdk"],
@@ -76,6 +83,7 @@ pkg_filegroup(
7683
srcs = [
7784
":extractor",
7885
":swift-test-sdk-arch",
86+
":resource-dir-arch",
7987
] + select({
8088
"@platforms//os:linux": [
8189
":incompatible-os",

swift/actions/build-and-test/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ runs:
4444
mkdir -p bazel-cache/{repository,disk}
4545
echo build --repository_cache=bazel-cache/repository --disk_cache=bazel-cache/disk > local.bazelrc
4646
echo test --test_output=errors >> local.bazelrc
47-
- name: Print unextracted entities
48-
shell: bash
49-
run: |
50-
bazel run //swift/extractor/print_unextracted
47+
# - name: Print unextracted entities
48+
# shell: bash
49+
# run: |
50+
# bazel run //swift/extractor/print_unextracted
5151
- uses: ./swift/actions/share-extractor-pack
5252
- name: Build Swift extractor
5353
shell: bash

swift/actions/run-integration-tests/action.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,12 @@ runs:
44
using: composite
55
steps:
66
- uses: ./swift/actions/share-extractor-pack
7-
- name: Get Swift version
8-
id: get_swift_version
9-
shell: bash
10-
run: |
11-
VERSION=$(swift/extractor-pack/tools/*/extractor --version | awk '/version/ { print $3 }')
12-
echo "version=$VERSION" | tee -a $GITHUB_OUTPUT
137
- uses: actions/setup-python@v4
148
with:
159
python-version-file: 'swift/.python-version'
16-
- uses: swift-actions/setup-swift@da0e3e04b5e3e15dbc3861bd835ad9f0afe56296
10+
- uses: swift-actions/setup-swift@65540b95f51493d65f5e59e97dcef9629ddf11bf
1711
with:
18-
swift-version: "${{steps.get_swift_version.outputs.version}}"
12+
swift-version: "5.8"
1913
- uses: ./.github/actions/fetch-codeql
2014
- id: query-cache
2115
uses: ./.github/actions/cache-query-compilation
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
class Element extends @element {
2+
string toString() { none() }
3+
}
4+
5+
newtype TAddedUnspecifiedElement =
6+
TNonExplicitClosureExprClosureBody(Element list, Element body) {
7+
capture_list_exprs(list, body) and not explicit_closure_exprs(body)
8+
}
9+
10+
module Fresh = QlBuiltins::NewEntity<TAddedUnspecifiedElement>;
11+
12+
class TNewElement = @element or Fresh::EntityId;
13+
14+
class NewElement extends TNewElement {
15+
string toString() { none() }
16+
}
17+
18+
query predicate new_unspecified_elements(NewElement u, string property, string error) {
19+
unspecified_elements(u, property, error)
20+
or
21+
u = Fresh::map(TNonExplicitClosureExprClosureBody(_, _)) and
22+
property = "closure_body" and
23+
error = "while downgrading: closure_body not an @explicit_closure_expr"
24+
}
25+
26+
query predicate new_unspecified_element_parents(NewElement u, Element parent) {
27+
unspecified_element_parents(u, parent)
28+
or
29+
u = Fresh::map(TNonExplicitClosureExprClosureBody(parent, _))
30+
}
31+
32+
query predicate new_capture_list_exprs(Element list, NewElement body) {
33+
capture_list_exprs(list, body) and explicit_closure_exprs(body)
34+
or
35+
body = Fresh::map(TNonExplicitClosureExprClosureBody(list, _))
36+
}

0 commit comments

Comments
 (0)