Skip to content

Commit 601b43a

Browse files
committed
Merge branch 'main' into rdmarsh2/parameterize-range-analysis
Conflicting change to boundedPhiInp copied to RangeAnalysisStage.qll
2 parents 337a747 + 2d46272 commit 601b43a

File tree

679 files changed

+33274
-14330
lines changed

Some content is hidden

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

679 files changed

+33274
-14330
lines changed

.github/actions/os-version/action.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: OS Version
2+
description: Get OS version.
3+
4+
outputs:
5+
version:
6+
description: "OS version"
7+
value: ${{ steps.version.outputs.version }}
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- if: runner.os == 'Linux'
13+
shell: bash
14+
run: |
15+
. /etc/os-release
16+
echo "VERSION=${NAME} ${VERSION}" >> $GITHUB_ENV
17+
- if: runner.os == 'Windows'
18+
shell: powershell
19+
run: |
20+
$objects = systeminfo.exe /FO CSV | ConvertFrom-Csv
21+
"VERSION=$($objects.'OS Name') $($objects.'OS Version')" >> $env:GITHUB_ENV
22+
- if: runner.os == 'macOS'
23+
shell: bash
24+
run: |
25+
echo "VERSION=$(sw_vers -productName) $(sw_vers -productVersion)" >> $GITHUB_ENV
26+
- name: Emit OS version
27+
id: version
28+
shell: bash
29+
run: |
30+
echo "$VERSION"
31+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
32+

.github/workflows/mad_modelDiff.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
branches:
1212
- main
1313
paths:
14-
- "java/ql/src/utils/model-generator/**/*.*"
14+
- "java/ql/src/utils/modelgenerator/**/*.*"
1515
- ".github/workflows/mad_modelDiff.yml"
1616

1717
permissions:
@@ -40,12 +40,12 @@ jobs:
4040
- name: Download database
4141
env:
4242
SLUG: ${{ matrix.slug }}
43+
GH_TOKEN: ${{ github.token }}
4344
run: |
4445
set -x
4546
mkdir lib-dbs
4647
SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}
47-
projectId=`curl -s https://lgtm.com/api/v1.0/projects/g/${SLUG} | jq .id`
48-
curl -L "https://lgtm.com/api/v1.0/snapshots/$projectId/java" -o "$SHORTNAME.zip"
48+
gh api -H "Accept: application/zip" "/repos/${SLUG}/code-scanning/codeql/databases/java" > "$SHORTNAME.zip"
4949
unzip -q -d "${SHORTNAME}-db" "${SHORTNAME}.zip"
5050
mkdir "lib-dbs/$SHORTNAME/"
5151
mv "${SHORTNAME}-db/"$(ls -1 "${SHORTNAME}"-db)/* "lib-dbs/${SHORTNAME}/"
@@ -61,7 +61,7 @@ jobs:
6161
DATABASE=$2
6262
cd codeql-$QL_VARIANT
6363
SHORTNAME=`basename $DATABASE`
64-
python java/ql/src/utils/model-generator/GenerateFlowModel.py --with-summaries --with-sinks $DATABASE ${SHORTNAME}.temp.model.yml
64+
python java/ql/src/utils/modelgenerator/GenerateFlowModel.py --with-summaries --with-sinks $DATABASE ${SHORTNAME}.temp.model.yml
6565
mv java/ql/lib/ext/generated/${SHORTNAME}.temp.model.yml $MODELS/${SHORTNAME}Generated_${QL_VARIANT}.model.yml
6666
cd ..
6767
}
@@ -100,4 +100,6 @@ jobs:
100100
with:
101101
name: diffs
102102
path: tmp-models/*.html
103+
# An html file is only produced if the generated models differ.
104+
if-no-files-found: ignore
103105
retention-days: 20

.github/workflows/mad_regenerate-models.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
SLUG: ${{ matrix.slug }}
5151
run: |
5252
SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}
53-
java/ql/src/utils/model-generator/RegenerateModels.py "${SLUG}" dbs/${SHORTNAME}
53+
java/ql/src/utils/modelgenerator/RegenerateModels.py "${SLUG}" dbs/${SHORTNAME}
5454
- name: Stage changes
5555
run: |
5656
find java -name "*.model.yml" -print0 | xargs -0 git add

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
uses: ./.github/actions/find-latest-bundle
2828
- name: Find codeql
2929
id: find-codeql
30-
uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
30+
uses: github/codeql-action/init@45955cb1830b640e2c1603ad72ad542a49d47b96
3131
with:
3232
languages: javascript # does not matter
3333
tools: ${{ steps.find-latest-bundle.outputs.url }}
@@ -38,12 +38,14 @@ jobs:
3838
shell: bash
3939
env:
4040
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
41+
- uses: ./.github/actions/os-version
42+
id: os_version
4143
- name: Cache entire pack
4244
id: cache-pack
4345
uses: actions/cache@v3
4446
with:
4547
path: ${{ runner.temp }}/pack
46-
key: ${{ runner.os }}-pack-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}-${{ hashFiles('ql/**/*.ql*') }}-${{ hashFiles('ql/**/qlpack.yml') }}-${{ hashFiles('ql/ql/src/ql.dbscheme*') }}-${{ steps.get-codeql-version.outputs.version }}--${{ hashFiles('.github/workflows/ql-for-ql-build.yml') }}
48+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-pack-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}-${{ hashFiles('ql/**/*.ql*') }}-${{ hashFiles('ql/**/qlpack.yml') }}-${{ hashFiles('ql/ql/src/ql.dbscheme*') }}-${{ steps.get-codeql-version.outputs.version }}--${{ hashFiles('.github/workflows/ql-for-ql-build.yml') }}
4749
- name: Cache queries
4850
if: steps.cache-pack.outputs.cache-hit != 'true'
4951
id: cache-queries
@@ -77,7 +79,7 @@ jobs:
7779
ql/target/release/ql-autobuilder.exe
7880
ql/target/release/ql-extractor
7981
ql/target/release/ql-extractor.exe
80-
key: ${{ runner.os }}-extractor-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}
82+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-extractor-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}
8183
- name: Cache cargo
8284
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
8385
uses: actions/cache@v3
@@ -86,7 +88,7 @@ jobs:
8688
~/.cargo/registry
8789
~/.cargo/git
8890
ql/target
89-
key: ${{ runner.os }}-rust-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
91+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-rust-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
9092
- name: Check formatting
9193
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
9294
run: cd ql; cargo fmt --all -- --check
@@ -137,20 +139,20 @@ jobs:
137139
env:
138140
CONF: ./ql-for-ql-config.yml
139141
- name: Initialize CodeQL
140-
uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
142+
uses: github/codeql-action/init@45955cb1830b640e2c1603ad72ad542a49d47b96
141143
with:
142144
languages: ql
143145
db-location: ${{ runner.temp }}/db
144146
config-file: ./ql-for-ql-config.yml
145147
tools: ${{ steps.find-latest-bundle.outputs.url }}
146-
- name: Move pack cache
148+
- name: Move pack queries
147149
run: |
148-
cp -r ${PACK}/.cache ql/ql/src/.cache
150+
cp -r ${PACK}/queries ql/ql/src
149151
env:
150152
PACK: ${{ runner.temp }}/pack
151153

152154
- name: Perform CodeQL Analysis
153-
uses: github/codeql-action/analyze@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
155+
uses: github/codeql-action/analyze@45955cb1830b640e2c1603ad72ad542a49d47b96
154156
with:
155157
category: "ql-for-ql"
156158
- name: Copy sarif file to CWD
@@ -172,4 +174,4 @@ jobs:
172174
with:
173175
name: ql-for-ql-langs
174176
path: split-sarif
175-
retention-days: 1
177+
retention-days: 1

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,18 @@ jobs:
2525

2626
- name: Find codeql
2727
id: find-codeql
28-
uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
28+
uses: github/codeql-action/init@45955cb1830b640e2c1603ad72ad542a49d47b96
2929
with:
3030
languages: javascript # does not matter
31+
- uses: ./.github/actions/os-version
32+
id: os_version
3133
- uses: actions/cache@v3
3234
with:
3335
path: |
3436
~/.cargo/registry
3537
~/.cargo/git
3638
ql/target
37-
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
39+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
3840
- name: Build Extractor
3941
run: cd ql; env "PATH=$PATH:`dirname ${CODEQL}`" ./scripts/create-extractor-pack.sh
4042
env:

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ jobs:
2222
- uses: actions/checkout@v3
2323
- name: Find codeql
2424
id: find-codeql
25-
uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
25+
uses: github/codeql-action/init@45955cb1830b640e2c1603ad72ad542a49d47b96
2626
with:
2727
languages: javascript # does not matter
28+
- uses: ./.github/actions/os-version
29+
id: os_version
2830
- uses: actions/cache@v3
2931
with:
3032
path: |
3133
~/.cargo/registry
3234
~/.cargo/git
3335
ql/target
34-
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
36+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
3537
- name: Build extractor
3638
run: |
3739
cd ql;

.github/workflows/ruby-build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ jobs:
4848
run: |
4949
brew install gnu-tar
5050
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
51+
- uses: ./.github/actions/os-version
52+
id: os_version
5153
- name: Cache entire extractor
5254
uses: actions/cache@v3
5355
id: cache-extractor
@@ -58,15 +60,15 @@ jobs:
5860
ruby/target/release/ruby-extractor
5961
ruby/target/release/ruby-extractor.exe
6062
ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
61-
key: ${{ runner.os }}-ruby-extractor-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}--${{ hashFiles('ruby/**/*.rs') }}
63+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-extractor-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}--${{ hashFiles('ruby/**/*.rs') }}
6264
- uses: actions/cache@v3
6365
if: steps.cache-extractor.outputs.cache-hit != 'true'
6466
with:
6567
path: |
6668
~/.cargo/registry
6769
~/.cargo/git
6870
ruby/target
69-
key: ${{ runner.os }}-ruby-rust-cargo-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}
71+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-rust-cargo-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}
7072
- name: Check formatting
7173
if: steps.cache-extractor.outputs.cache-hit != 'true'
7274
run: cargo fmt --all -- --check

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ If you have an idea for a query that you would like to share with other CodeQL u
2525

2626
Each language-specific directory contains further subdirectories that group queries based on their `@tags` or purpose.
2727
- Experimental queries and libraries are stored in the `experimental` subdirectory within each language-specific directory in the [CodeQL repository](https://github.com/github/codeql). For example, experimental Java queries and libraries are stored in `java/ql/src/experimental` and any corresponding tests in `java/ql/test/experimental`.
28+
- Experimental queries need to include `experimental` in their `@tags`
2829
- The structure of an `experimental` subdirectory mirrors the structure of its parent directory.
2930
- Select or create an appropriate directory in `experimental` based on the existing directory structure of `experimental` or its parent directory.
3031

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class BuiltinType extends @builtintype {
2+
string toString() { none() }
3+
}
4+
5+
from BuiltinType type, string name, int kind, int kind_new, int size, int sign, int alignment
6+
where
7+
builtintypes(type, name, kind, size, sign, alignment) and
8+
if type instanceof @float16 or type instanceof @complex_float16
9+
then kind_new = 2
10+
else kind_new = kind
11+
select type, name, kind_new, size, sign, alignment

0 commit comments

Comments
 (0)