Skip to content

Commit e594074

Browse files
committed
Merge branch 'main' into http
2 parents 72a8ab3 + 7644012 commit e594074

File tree

465 files changed

+4231
-3109
lines changed

Some content is hidden

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

465 files changed

+4231
-3109
lines changed

MODULE.bazel

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ local_path_override(
1414

1515
# see https://registry.bazel.build/ for a list of available packages
1616

17-
bazel_dep(name = "platforms", version = "0.0.10")
17+
bazel_dep(name = "platforms", version = "0.0.11")
1818
bazel_dep(name = "rules_go", version = "0.50.1")
1919
bazel_dep(name = "rules_pkg", version = "1.0.1")
2020
bazel_dep(name = "rules_nodejs", version = "6.2.0-codeql.1")
@@ -28,7 +28,7 @@ bazel_dep(name = "rules_kotlin", version = "2.0.0-codeql.1")
2828
bazel_dep(name = "gazelle", version = "0.40.0")
2929
bazel_dep(name = "rules_dotnet", version = "0.17.4")
3030
bazel_dep(name = "googletest", version = "1.14.0.bcr.1")
31-
bazel_dep(name = "rules_rust", version = "0.52.2")
31+
bazel_dep(name = "rules_rust", version = "0.57.1")
3232
bazel_dep(name = "zstd", version = "1.5.5.bcr.1")
3333

3434
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
@@ -53,15 +53,6 @@ use_repo(rust, "rust_toolchains")
5353

5454
register_toolchains("@rust_toolchains//:all")
5555

56-
rust_host_tools = use_extension("@rules_rust//rust:extensions.bzl", "rust_host_tools")
57-
58-
# Don't download a second toolchain as host toolchain, make sure this is the same version as above
59-
# The host toolchain is used for vendoring dependencies.
60-
rust_host_tools.host_tools(
61-
edition = RUST_EDITION,
62-
version = RUST_VERSION,
63-
)
64-
6556
# deps for python extractor
6657
# keep in sync by running `misc/bazel/3rdparty/update_cargo_deps.sh`
6758
py_deps = use_extension("//misc/bazel/3rdparty:py_deps_extension.bzl", "p")

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaInternalsCommon.qll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,4 @@ module InputSigCommon {
769769
BasicBlock getImmediateBasicBlockDominator(BasicBlock bb) { result.immediatelyDominates(bb) }
770770

771771
BasicBlock getABasicBlockSuccessor(BasicBlock bb) { result = bb.getASuccessor() }
772-
773-
class ExitBasicBlock extends BasicBlock {
774-
ExitBasicBlock() { this.getLastInstruction() instanceof ExitFunctionInstruction }
775-
}
776772
}

csharp/.vscode/launch.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@
7070
// Set the path to the folder that should be extracted:
7171
"cwd": "${workspaceFolder}/ql/test/library-tests/dataflow/local",
7272
"args": [
73-
"LocalDataFlow.cs"
73+
"LocalDataFlow.cs",
74+
"/r:System.Private.CoreLib.dll"
7475
],
7576
"env": {},
7677
"stopAtEntry": true,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
category: deprecated
3+
---
4+
* The predicates `immediatelyControls` and `controls` on the `ConditionBlock`
5+
class have been deprecated in favor of the newly added `dominatingEdge`
6+
predicate.

csharp/ql/lib/semmle/code/csharp/controlflow/BasicBlocks.qll

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,29 @@ final class BasicBlock extends BasicBlocksImpl::BasicBlock {
202202
*/
203203
BasicBlock getImmediateDominator() { result = super.getImmediateDominator() }
204204

205+
/**
206+
* Holds if the edge with successor type `s` out of this basic block is a
207+
* dominating edge for `dominated`.
208+
*
209+
* That is, all paths reaching `dominated` from the entry point basic
210+
* block must go through the `s` edge out of this basic block.
211+
*
212+
* Edge dominance is similar to node dominance except it concerns edges
213+
* instead of nodes: A basic block is dominated by a _basic block_ `bb` if it
214+
* can only be reached through `bb` and dominated by an _edge_ `e` if it can
215+
* only be reached through `e`.
216+
*
217+
* Note that where all basic blocks (except the entry basic block) are
218+
* strictly dominated by at least one basic block, a basic block may not be
219+
* dominated by any edge. If an edge dominates a basic block `bb`, then
220+
* both endpoints of the edge dominates `bb`. The converse is not the case,
221+
* as there may be multiple paths between the endpoints with none of them
222+
* dominating.
223+
*/
224+
predicate edgeDominates(BasicBlock dominated, ControlFlow::SuccessorType s) {
225+
super.edgeDominates(dominated, s)
226+
}
227+
205228
/**
206229
* Holds if this basic block strictly post-dominates basic block `bb`.
207230
*
@@ -296,11 +319,14 @@ final class JoinBlockPredecessor extends BasicBlock, BasicBlocksImpl::JoinPredec
296319
* control flow.
297320
*/
298321
final class ConditionBlock extends BasicBlock, BasicBlocksImpl::ConditionBasicBlock {
299-
predicate immediatelyControls(BasicBlock succ, ConditionalSuccessor s) {
300-
super.immediatelyControls(succ, s)
322+
/** DEPRECATED: Use `edgeDominates` instead. */
323+
deprecated predicate immediatelyControls(BasicBlock succ, ConditionalSuccessor s) {
324+
this.getASuccessor(s) = succ and
325+
BasicBlocksImpl::dominatingEdge(this, succ)
301326
}
302327

303-
predicate controls(BasicBlock controlled, ConditionalSuccessor s) {
304-
super.controls(controlled, s)
328+
/** DEPRECATED: Use `edgeDominates` instead. */
329+
deprecated predicate controls(BasicBlock controlled, ConditionalSuccessor s) {
330+
super.edgeDominates(controlled, s)
305331
}
306332
}

csharp/ql/lib/semmle/code/csharp/controlflow/ControlFlowElement.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,6 @@ class ControlFlowElement extends ExprOrStmtParent, @control_flow_element {
225225
this.controlsBlockSplit(controlled, s, cb)
226226
or
227227
cb.getLastNode() = this.getAControlFlowNode() and
228-
cb.controls(controlled, s)
228+
cb.edgeDominates(controlled, s)
229229
}
230230
}

csharp/ql/lib/semmle/code/csharp/controlflow/internal/PreSsa.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ module PreSsa {
9090

9191
BasicBlock getABasicBlockSuccessor(BasicBlock bb) { result = bb.getASuccessor() }
9292

93-
class ExitBasicBlock extends BasicBlock {
93+
private class ExitBasicBlock extends BasicBlock {
9494
ExitBasicBlock() { scopeLast(_, this.getLastElement(), _) }
9595
}
9696

csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ module Ssa {
345345
* - The read of `this.Field` on line 11 is a last read of the phi node
346346
* between lines 9 and 10.
347347
*/
348-
final AssignableRead getALastRead() { result = this.getALastReadAtNode(_) }
348+
deprecated final AssignableRead getALastRead() { result = this.getALastReadAtNode(_) }
349349

350350
/**
351351
* Gets a last read of the source variable underlying this SSA definition at
@@ -375,7 +375,7 @@ module Ssa {
375375
* - The read of `this.Field` on line 11 is a last read of the phi node
376376
* between lines 9 and 10.
377377
*/
378-
final AssignableRead getALastReadAtNode(ControlFlow::Node cfn) {
378+
deprecated final AssignableRead getALastReadAtNode(ControlFlow::Node cfn) {
379379
SsaImpl::lastReadSameVar(this, cfn) and
380380
result.getAControlFlowNode() = cfn
381381
}

csharp/ql/lib/semmle/code/csharp/dataflow/internal/BaseSSA.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ module BaseSsa {
5555

5656
BasicBlock getABasicBlockSuccessor(BasicBlock bb) { result = bb.getASuccessor() }
5757

58-
class ExitBasicBlock extends BasicBlock, ControlFlow::BasicBlocks::ExitBlock { }
59-
6058
class SourceVariable = PreSsa::SimpleLocalScopeVariable;
6159

6260
predicate variableWrite(BasicBlock bb, int i, SourceVariable v, boolean certain) {

csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ private module SsaInput implements SsaImplCommon::InputSig<Location> {
1717

1818
BasicBlock getABasicBlockSuccessor(BasicBlock bb) { result = bb.getASuccessor() }
1919

20-
class ExitBasicBlock extends BasicBlock, ControlFlow::BasicBlocks::ExitBlock { }
21-
2220
class SourceVariable = Ssa::SourceVariable;
2321

2422
/**
@@ -784,7 +782,9 @@ private predicate adjacentDefReachesUncertainRead(
784782

785783
/** Same as `lastRefRedef`, but skips uncertain reads. */
786784
pragma[nomagic]
787-
private predicate lastRefSkipUncertainReads(Definition def, SsaInput::BasicBlock bb, int i) {
785+
deprecated private predicate lastRefSkipUncertainReads(
786+
Definition def, SsaInput::BasicBlock bb, int i
787+
) {
788788
Impl::lastRef(def, bb, i) and
789789
not SsaInput::variableRead(bb, i, def.getSourceVariable(), false)
790790
or
@@ -794,6 +794,15 @@ private predicate lastRefSkipUncertainReads(Definition def, SsaInput::BasicBlock
794794
)
795795
}
796796

797+
pragma[nomagic]
798+
deprecated predicate lastReadSameVar(Definition def, ControlFlow::Node cfn) {
799+
exists(ControlFlow::BasicBlock bb, int i |
800+
lastRefSkipUncertainReads(def, bb, i) and
801+
variableReadActual(bb, i, _) and
802+
cfn = bb.getNode(i)
803+
)
804+
}
805+
797806
cached
798807
private module Cached {
799808
cached
@@ -957,15 +966,6 @@ private module Cached {
957966
)
958967
}
959968

960-
cached
961-
predicate lastReadSameVar(Definition def, ControlFlow::Node cfn) {
962-
exists(ControlFlow::BasicBlock bb, int i |
963-
lastRefSkipUncertainReads(def, bb, i) and
964-
variableReadActual(bb, i, _) and
965-
cfn = bb.getNode(i)
966-
)
967-
}
968-
969969
cached
970970
Definition uncertainWriteDefinitionInput(UncertainWriteDefinition def) {
971971
Impl::uncertainWriteDefinitionInput(def, result)
@@ -1119,7 +1119,7 @@ private module DataFlowIntegrationInput implements Impl::DataFlowIntegrationInpu
11191119
exists(ConditionBlock conditionBlock, ControlFlow::SuccessorTypes::ConditionalSuccessor s |
11201120
guard.getAControlFlowNode() = conditionBlock.getLastNode() and
11211121
s.getValue() = branch and
1122-
conditionBlock.controls(bb, s)
1122+
conditionBlock.edgeDominates(bb, s)
11231123
)
11241124
}
11251125

0 commit comments

Comments
 (0)