Skip to content

Commit fbe9823

Browse files
authored
Merge branch 'main' into henrymercer/polish-diagnostics
2 parents 1454890 + 604d5f0 commit fbe9823

File tree

824 files changed

+32300
-2386
lines changed

Some content is hidden

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

824 files changed

+32300
-2386
lines changed

.github/workflows/ruby-build.yml

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -55,35 +55,35 @@ jobs:
5555
id: cache-extractor
5656
with:
5757
path: |
58-
ruby/target/release/ruby-autobuilder
59-
ruby/target/release/ruby-autobuilder.exe
60-
ruby/target/release/ruby-extractor
61-
ruby/target/release/ruby-extractor.exe
62-
ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
63-
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-extractor-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}--${{ hashFiles('ruby/**/*.rs') }}
58+
ruby/extractor/target/release/autobuilder
59+
ruby/extractor/target/release/autobuilder.exe
60+
ruby/extractor/target/release/extractor
61+
ruby/extractor/target/release/extractor.exe
62+
ruby/extractor/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
63+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-extractor-${{ hashFiles('ruby/extractor/rust-toolchain.toml', 'ruby/extractor/Cargo.lock') }}--${{ hashFiles('ruby/extractor/**/*.rs') }}
6464
- uses: actions/cache@v3
6565
if: steps.cache-extractor.outputs.cache-hit != 'true'
6666
with:
6767
path: |
6868
~/.cargo/registry
6969
~/.cargo/git
7070
ruby/target
71-
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-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/extractor/rust-toolchain.toml', 'ruby/extractor/**/Cargo.lock') }}
7272
- name: Check formatting
7373
if: steps.cache-extractor.outputs.cache-hit != 'true'
74-
run: cargo fmt --all -- --check
74+
run: cd extractor && cargo fmt --all -- --check
7575
- name: Build
7676
if: steps.cache-extractor.outputs.cache-hit != 'true'
77-
run: cargo build --verbose
77+
run: cd extractor && cargo build --verbose
7878
- name: Run tests
7979
if: steps.cache-extractor.outputs.cache-hit != 'true'
80-
run: cargo test --verbose
80+
run: cd extractor && cargo test --verbose
8181
- name: Release build
8282
if: steps.cache-extractor.outputs.cache-hit != 'true'
83-
run: cargo build --release
83+
run: cd extractor && cargo build --release
8484
- name: Generate dbscheme
8585
if: ${{ matrix.os == 'ubuntu-latest' && steps.cache-extractor.outputs.cache-hit != 'true'}}
86-
run: target/release/ruby-generator --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
86+
run: extractor/target/release/generator --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
8787
- uses: actions/upload-artifact@v3
8888
if: ${{ matrix.os == 'ubuntu-latest' }}
8989
with:
@@ -98,10 +98,10 @@ jobs:
9898
with:
9999
name: extractor-${{ matrix.os }}
100100
path: |
101-
ruby/target/release/ruby-autobuilder
102-
ruby/target/release/ruby-autobuilder.exe
103-
ruby/target/release/ruby-extractor
104-
ruby/target/release/ruby-extractor.exe
101+
ruby/extractor/target/release/autobuilder
102+
ruby/extractor/target/release/autobuilder.exe
103+
ruby/extractor/target/release/extractor
104+
ruby/extractor/target/release/extractor.exe
105105
retention-days: 1
106106
compile-queries:
107107
runs-on: ubuntu-latest-xl
@@ -116,21 +116,22 @@ jobs:
116116
key: ruby-build
117117
- name: Build Query Pack
118118
run: |
119-
rm -rf target/packs
120-
codeql pack create ../misc/suite-helpers --output target/packs
121-
codeql pack create ../shared/regex --output target/packs
122-
codeql pack create ../shared/ssa --output target/packs
123-
codeql pack create ../shared/tutorial --output target/packs
124-
codeql pack create ql/lib --output target/packs
125-
codeql pack create -j0 ql/src --output target/packs --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
126-
PACK_FOLDER=$(readlink -f target/packs/codeql/ruby-queries/*)
119+
PACKS=${{ runner.temp }}/query-packs
120+
rm -rf $PACKS
121+
codeql pack create ../misc/suite-helpers --output "$PACKS"
122+
codeql pack create ../shared/regex --output "$PACKS"
123+
codeql pack create ../shared/ssa --output "$PACKS"
124+
codeql pack create ../shared/tutorial --output "$PACKS"
125+
codeql pack create ql/lib --output "$PACKS"
126+
codeql pack create -j0 ql/src --output "$PACKS" --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
127+
PACK_FOLDER=$(readlink -f "$PACKS"/codeql/ruby-queries/*)
127128
codeql generate query-help --format=sarifv2.1.0 --output="${PACK_FOLDER}/rules.sarif" ql/src
128129
(cd ql/src; find queries \( -name '*.qhelp' -o -name '*.rb' -o -name '*.erb' \) -exec bash -c 'mkdir -p "'"${PACK_FOLDER}"'/$(dirname "{}")"' \; -exec cp "{}" "${PACK_FOLDER}/{}" \;)
129130
- uses: actions/upload-artifact@v3
130131
with:
131132
name: codeql-ruby-queries
132133
path: |
133-
ruby/target/packs/*
134+
${{ runner.temp }}/query-packs/*
134135
retention-days: 1
135136

136137
package:
@@ -158,12 +159,12 @@ jobs:
158159
mkdir -p ruby
159160
cp -r codeql-extractor.yml tools ql/lib/ruby.dbscheme.stats ruby/
160161
mkdir -p ruby/tools/{linux64,osx64,win64}
161-
cp linux64/ruby-autobuilder ruby/tools/linux64/autobuilder
162-
cp osx64/ruby-autobuilder ruby/tools/osx64/autobuilder
163-
cp win64/ruby-autobuilder.exe ruby/tools/win64/autobuilder.exe
164-
cp linux64/ruby-extractor ruby/tools/linux64/extractor
165-
cp osx64/ruby-extractor ruby/tools/osx64/extractor
166-
cp win64/ruby-extractor.exe ruby/tools/win64/extractor.exe
162+
cp linux64/autobuilder ruby/tools/linux64/autobuilder
163+
cp osx64/autobuilder ruby/tools/osx64/autobuilder
164+
cp win64/autobuilder.exe ruby/tools/win64/autobuilder.exe
165+
cp linux64/extractor ruby/tools/linux64/extractor
166+
cp osx64/extractor ruby/tools/osx64/extractor
167+
cp win64/extractor.exe ruby/tools/win64/extractor.exe
167168
chmod +x ruby/tools/{linux64,osx64}/{autobuilder,extractor}
168169
zip -rq codeql-ruby.zip ruby
169170
- uses: actions/upload-artifact@v3
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* Deleted the deprecated `hasGeneratedCopyConstructor` and `hasGeneratedCopyAssignmentOperator` predicates from the `Folder` class.
5+
* Deleted the deprecated `getPath` and `getFolder` predicates from the `XmlFile` class.
6+
* Deleted the deprecated `getMustlockFunction`, `getTrylockFunction`, `getLockFunction`, and `getUnlockFunction` predicates from the `MutexType` class.
7+
* Deleted the deprecated `getPosInBasicBlock` predicate from the `SubBasicBlock` class.
8+
* Deleted the deprecated `getExpr` predicate from the `PointerDereferenceExpr` class.
9+
* Deleted the deprecated `getUseInstruction` and `getDefinitionInstruction` predicates from the `Operand` class.
10+
* Deleted the deprecated `isInParameter`, `isInParameterPointer`, and `isInQualifier` predicates from the `FunctionInput` class.
11+
* Deleted the deprecated `isOutParameterPointer`, `isOutQualifier`, `isOutReturnValue`, and `isOutReturnPointer` predicate from the `FunctionOutput` class.
12+
* Deleted the deprecated 3-argument `isGuardPhi` predicate from the `RangeSsaDefinition` class.

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ private module LambdaFlow {
182182
boolean toJump, DataFlowCallOption lastCall
183183
) {
184184
revLambdaFlow0(lambdaCall, kind, node, t, toReturn, toJump, lastCall) and
185+
not expectsContent(node, _) and
185186
if castNode(node) or node instanceof ArgNode or node instanceof ReturnNode
186187
then compatibleTypes(t, getNodeDataFlowType(node))
187188
else any()

cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysisStage.qll

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,15 @@ module RangeStage<DeltaSig D, BoundSig<D> Bounds, LangSig<D> LangParam, UtilSig<
936936
bounded(cast.getOperand(), b, delta, upper, fromBackEdge, origdelta, reason)
937937
}
938938

939+
/**
940+
* Computes a normal form of `x` where -0.0 has changed to +0.0. This can be
941+
* needed on the lesser side of a floating-point comparison or on both sides of
942+
* a floating point equality because QL does not follow IEEE in floating-point
943+
* comparisons but instead defines -0.0 to be less than and distinct from 0.0.
944+
*/
945+
bindingset[x]
946+
private float normalizeFloatUp(float x) { result = x + 0.0 }
947+
939948
/**
940949
* Holds if `b + delta` is a valid bound for `e`.
941950
* - `upper = true` : `e <= b + delta`
@@ -1020,6 +1029,15 @@ module RangeStage<DeltaSig D, BoundSig<D> Bounds, LangSig<D> LangParam, UtilSig<
10201029
or
10211030
upper = false and delta = D::fromFloat(D::toFloat(d1).minimum(D::toFloat(d2)))
10221031
)
1032+
or
1033+
exists(SemExpr mid, D::Delta d, float f |
1034+
e.(SemNegateExpr).getOperand() = mid and
1035+
b instanceof SemZeroBound and
1036+
bounded(mid, b, d, upper.booleanNot(), fromBackEdge, origdelta, reason) and
1037+
f = normalizeFloatUp(-D::toFloat(d)) and
1038+
delta = D::fromFloat(f) and
1039+
if semPositive(e) then f >= 0 else any()
1040+
)
10231041
)
10241042
}
10251043

cpp/ql/lib/semmle/code/cpp/Class.qll

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -227,18 +227,6 @@ class Class extends UserType {
227227
result = this.accessOfBaseMember(member.getDeclaringType(), member.getASpecifier())
228228
}
229229

230-
/**
231-
* DEPRECATED: name changed to `hasImplicitCopyConstructor` to reflect that
232-
* `= default` members are no longer included.
233-
*/
234-
deprecated predicate hasGeneratedCopyConstructor() { this.hasImplicitCopyConstructor() }
235-
236-
/**
237-
* DEPRECATED: name changed to `hasImplicitCopyAssignmentOperator` to
238-
* reflect that `= default` members are no longer included.
239-
*/
240-
deprecated predicate hasGeneratedCopyAssignmentOperator() { this.hasImplicitCopyConstructor() }
241-
242230
/**
243231
* Holds if this class, struct or union has an implicitly-declared copy
244232
* constructor that is not _deleted_. This predicate is more accurate than

cpp/ql/lib/semmle/code/cpp/XML.qll

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,6 @@ class XmlFile extends XmlParent, File {
108108
/** Gets the name of this XML file. */
109109
override string getName() { result = File.super.getAbsolutePath() }
110110

111-
/**
112-
* DEPRECATED: Use `getAbsolutePath()` instead.
113-
*
114-
* Gets the path of this XML file.
115-
*/
116-
deprecated string getPath() { result = this.getAbsolutePath() }
117-
118-
/**
119-
* DEPRECATED: Use `getParentContainer().getAbsolutePath()` instead.
120-
*
121-
* Gets the path of the folder that contains this XML file.
122-
*/
123-
deprecated string getFolder() { result = this.getParentContainer().getAbsolutePath() }
124-
125111
/** Gets the encoding of this XML file. */
126112
string getEncoding() { xmlEncoding(this, result) }
127113

cpp/ql/lib/semmle/code/cpp/commons/Synchronization.qll

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,6 @@ abstract class MutexType extends Type {
5959
* Gets a call that unlocks any mutex of this type.
6060
*/
6161
FunctionCall getUnlockAccess() { this.unlockAccess(result, _) }
62-
63-
/**
64-
* DEPRECATED: use mustlockAccess(fc, arg) instead.
65-
*/
66-
deprecated Function getMustlockFunction() { result = this.getMustlockAccess().getTarget() }
67-
68-
/**
69-
* DEPRECATED: use trylockAccess(fc, arg) instead.
70-
*/
71-
deprecated Function getTrylockFunction() { result = this.getTrylockAccess().getTarget() }
72-
73-
/**
74-
* DEPRECATED: use lockAccess(fc, arg) instead.
75-
*/
76-
deprecated Function getLockFunction() { result = this.getLockAccess().getTarget() }
77-
78-
/**
79-
* DEPRECATED: use unlockAccess(fc, arg) instead.
80-
*/
81-
deprecated Function getUnlockFunction() { result = this.getUnlockAccess().getTarget() }
8262
}
8363

8464
/**

cpp/ql/lib/semmle/code/cpp/controlflow/SubBasicBlocks.qll

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,6 @@ class SubBasicBlock extends ControlFlowNodeBase {
7575
)
7676
}
7777

78-
/**
79-
* DEPRECATED: use `getRankInBasicBlock` instead. Note that this predicate
80-
* returns a 0-based position, while `getRankInBasicBlock` returns a 1-based
81-
* position.
82-
*/
83-
deprecated int getPosInBasicBlock(BasicBlock bb) { result = this.getRankInBasicBlock(bb) - 1 }
84-
8578
pragma[noinline]
8679
private int getIndexInBasicBlock(BasicBlock bb) { this = bb.getNode(result) }
8780

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ private module LambdaFlow {
182182
boolean toJump, DataFlowCallOption lastCall
183183
) {
184184
revLambdaFlow0(lambdaCall, kind, node, t, toReturn, toJump, lastCall) and
185+
not expectsContent(node, _) and
185186
if castNode(node) or node instanceof ArgNode or node instanceof ReturnNode
186187
then compatibleTypes(t, getNodeDataFlowType(node))
187188
else any()

cpp/ql/lib/semmle/code/cpp/dataflow/internal/SubBasicBlocks.qll

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,6 @@ class SubBasicBlock extends ControlFlowNodeBase {
7575
)
7676
}
7777

78-
/**
79-
* DEPRECATED: use `getRankInBasicBlock` instead. Note that this predicate
80-
* returns a 0-based position, while `getRankInBasicBlock` returns a 1-based
81-
* position.
82-
*/
83-
deprecated int getPosInBasicBlock(BasicBlock bb) { result = this.getRankInBasicBlock(bb) - 1 }
84-
8578
pragma[noinline]
8679
private int getIndexInBasicBlock(BasicBlock bb) { this = bb.getNode(result) }
8780

0 commit comments

Comments
 (0)