Skip to content

Commit ee5c30e

Browse files
committed
Merge main into redsun82/swift-extraction
2 parents 1e4ac44 + df6d68b commit ee5c30e

File tree

471 files changed

+47482
-45944
lines changed

Some content is hidden

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

471 files changed

+47482
-45944
lines changed

cpp/ql/lib/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.2.3
2+
3+
### New Features
4+
5+
* An `isBraced` predicate was added to the `Initializer` class which holds when a C++ braced initializer was used in the initialization.
6+
17
## 0.2.2
28

39
### Deprecated APIs
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: deprecated
3+
---
4+
* The `BarrierGuard` class has been deprecated. Such barriers and sanitizers can now instead be created using the new `BarrierGuard` parameterized module.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## 0.2.3
2+
3+
### New Features
4+
5+
* An `isBraced` predicate was added to the `Initializer` class which holds when a C++ braced initializer was used in the initialization.

cpp/ql/lib/codeql-pack.release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
lastReleaseVersion: 0.2.2
2+
lastReleaseVersion: 0.2.3

cpp/ql/lib/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cpp-all
2-
version: 0.2.3-dev
2+
version: 0.3.0-dev
33
groups: cpp
44
dbscheme: semmlecode.cpp.dbscheme
55
extractor: cpp

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

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,20 @@ abstract class Configuration extends string {
9090
/** Holds if data flow out of `node` is prohibited. */
9191
predicate isBarrierOut(Node node) { none() }
9292

93-
/** Holds if data flow through nodes guarded by `guard` is prohibited. */
94-
predicate isBarrierGuard(BarrierGuard guard) { none() }
93+
/**
94+
* DEPRECATED: Use `isBarrier` and `BarrierGuard` module instead.
95+
*
96+
* Holds if data flow through nodes guarded by `guard` is prohibited.
97+
*/
98+
deprecated predicate isBarrierGuard(BarrierGuard guard) { none() }
9599

96100
/**
101+
* DEPRECATED: Use `isBarrier` and `BarrierGuard` module instead.
102+
*
97103
* Holds if data flow through nodes guarded by `guard` is prohibited when
98104
* the flow state is `state`
99105
*/
100-
predicate isBarrierGuard(BarrierGuard guard, FlowState state) { none() }
106+
deprecated predicate isBarrierGuard(BarrierGuard guard, FlowState state) { none() }
101107

102108
/**
103109
* Holds if data may flow from `node1` to `node2` in addition to the normal data-flow steps.
@@ -335,6 +341,29 @@ private predicate outBarrier(NodeEx node, Configuration config) {
335341
)
336342
}
337343

344+
/** A bridge class to access the deprecated `isBarrierGuard`. */
345+
private class BarrierGuardGuardedNodeBridge extends Unit {
346+
abstract predicate guardedNode(Node n, Configuration config);
347+
348+
abstract predicate guardedNode(Node n, FlowState state, Configuration config);
349+
}
350+
351+
private class BarrierGuardGuardedNode extends BarrierGuardGuardedNodeBridge {
352+
deprecated override predicate guardedNode(Node n, Configuration config) {
353+
exists(BarrierGuard g |
354+
config.isBarrierGuard(g) and
355+
n = g.getAGuardedNode()
356+
)
357+
}
358+
359+
deprecated override predicate guardedNode(Node n, FlowState state, Configuration config) {
360+
exists(BarrierGuard g |
361+
config.isBarrierGuard(g, state) and
362+
n = g.getAGuardedNode()
363+
)
364+
}
365+
}
366+
338367
pragma[nomagic]
339368
private predicate fullBarrier(NodeEx node, Configuration config) {
340369
exists(Node n | node.asNode() = n |
@@ -348,10 +377,7 @@ private predicate fullBarrier(NodeEx node, Configuration config) {
348377
not config.isSink(n) and
349378
not config.isSink(n, _)
350379
or
351-
exists(BarrierGuard g |
352-
config.isBarrierGuard(g) and
353-
n = g.getAGuardedNode()
354-
)
380+
any(BarrierGuardGuardedNodeBridge b).guardedNode(n, config)
355381
)
356382
}
357383

@@ -360,10 +386,7 @@ private predicate stateBarrier(NodeEx node, FlowState state, Configuration confi
360386
exists(Node n | node.asNode() = n |
361387
config.isBarrier(n, state)
362388
or
363-
exists(BarrierGuard g |
364-
config.isBarrierGuard(g, state) and
365-
n = g.getAGuardedNode()
366-
)
389+
any(BarrierGuardGuardedNodeBridge b).guardedNode(n, state, config)
367390
)
368391
}
369392

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

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,20 @@ abstract class Configuration extends string {
9090
/** Holds if data flow out of `node` is prohibited. */
9191
predicate isBarrierOut(Node node) { none() }
9292

93-
/** Holds if data flow through nodes guarded by `guard` is prohibited. */
94-
predicate isBarrierGuard(BarrierGuard guard) { none() }
93+
/**
94+
* DEPRECATED: Use `isBarrier` and `BarrierGuard` module instead.
95+
*
96+
* Holds if data flow through nodes guarded by `guard` is prohibited.
97+
*/
98+
deprecated predicate isBarrierGuard(BarrierGuard guard) { none() }
9599

96100
/**
101+
* DEPRECATED: Use `isBarrier` and `BarrierGuard` module instead.
102+
*
97103
* Holds if data flow through nodes guarded by `guard` is prohibited when
98104
* the flow state is `state`
99105
*/
100-
predicate isBarrierGuard(BarrierGuard guard, FlowState state) { none() }
106+
deprecated predicate isBarrierGuard(BarrierGuard guard, FlowState state) { none() }
101107

102108
/**
103109
* Holds if data may flow from `node1` to `node2` in addition to the normal data-flow steps.
@@ -335,6 +341,29 @@ private predicate outBarrier(NodeEx node, Configuration config) {
335341
)
336342
}
337343

344+
/** A bridge class to access the deprecated `isBarrierGuard`. */
345+
private class BarrierGuardGuardedNodeBridge extends Unit {
346+
abstract predicate guardedNode(Node n, Configuration config);
347+
348+
abstract predicate guardedNode(Node n, FlowState state, Configuration config);
349+
}
350+
351+
private class BarrierGuardGuardedNode extends BarrierGuardGuardedNodeBridge {
352+
deprecated override predicate guardedNode(Node n, Configuration config) {
353+
exists(BarrierGuard g |
354+
config.isBarrierGuard(g) and
355+
n = g.getAGuardedNode()
356+
)
357+
}
358+
359+
deprecated override predicate guardedNode(Node n, FlowState state, Configuration config) {
360+
exists(BarrierGuard g |
361+
config.isBarrierGuard(g, state) and
362+
n = g.getAGuardedNode()
363+
)
364+
}
365+
}
366+
338367
pragma[nomagic]
339368
private predicate fullBarrier(NodeEx node, Configuration config) {
340369
exists(Node n | node.asNode() = n |
@@ -348,10 +377,7 @@ private predicate fullBarrier(NodeEx node, Configuration config) {
348377
not config.isSink(n) and
349378
not config.isSink(n, _)
350379
or
351-
exists(BarrierGuard g |
352-
config.isBarrierGuard(g) and
353-
n = g.getAGuardedNode()
354-
)
380+
any(BarrierGuardGuardedNodeBridge b).guardedNode(n, config)
355381
)
356382
}
357383

@@ -360,10 +386,7 @@ private predicate stateBarrier(NodeEx node, FlowState state, Configuration confi
360386
exists(Node n | node.asNode() = n |
361387
config.isBarrier(n, state)
362388
or
363-
exists(BarrierGuard g |
364-
config.isBarrierGuard(g, state) and
365-
n = g.getAGuardedNode()
366-
)
389+
any(BarrierGuardGuardedNodeBridge b).guardedNode(n, state, config)
367390
)
368391
}
369392

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

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,20 @@ abstract class Configuration extends string {
9090
/** Holds if data flow out of `node` is prohibited. */
9191
predicate isBarrierOut(Node node) { none() }
9292

93-
/** Holds if data flow through nodes guarded by `guard` is prohibited. */
94-
predicate isBarrierGuard(BarrierGuard guard) { none() }
93+
/**
94+
* DEPRECATED: Use `isBarrier` and `BarrierGuard` module instead.
95+
*
96+
* Holds if data flow through nodes guarded by `guard` is prohibited.
97+
*/
98+
deprecated predicate isBarrierGuard(BarrierGuard guard) { none() }
9599

96100
/**
101+
* DEPRECATED: Use `isBarrier` and `BarrierGuard` module instead.
102+
*
97103
* Holds if data flow through nodes guarded by `guard` is prohibited when
98104
* the flow state is `state`
99105
*/
100-
predicate isBarrierGuard(BarrierGuard guard, FlowState state) { none() }
106+
deprecated predicate isBarrierGuard(BarrierGuard guard, FlowState state) { none() }
101107

102108
/**
103109
* Holds if data may flow from `node1` to `node2` in addition to the normal data-flow steps.
@@ -335,6 +341,29 @@ private predicate outBarrier(NodeEx node, Configuration config) {
335341
)
336342
}
337343

344+
/** A bridge class to access the deprecated `isBarrierGuard`. */
345+
private class BarrierGuardGuardedNodeBridge extends Unit {
346+
abstract predicate guardedNode(Node n, Configuration config);
347+
348+
abstract predicate guardedNode(Node n, FlowState state, Configuration config);
349+
}
350+
351+
private class BarrierGuardGuardedNode extends BarrierGuardGuardedNodeBridge {
352+
deprecated override predicate guardedNode(Node n, Configuration config) {
353+
exists(BarrierGuard g |
354+
config.isBarrierGuard(g) and
355+
n = g.getAGuardedNode()
356+
)
357+
}
358+
359+
deprecated override predicate guardedNode(Node n, FlowState state, Configuration config) {
360+
exists(BarrierGuard g |
361+
config.isBarrierGuard(g, state) and
362+
n = g.getAGuardedNode()
363+
)
364+
}
365+
}
366+
338367
pragma[nomagic]
339368
private predicate fullBarrier(NodeEx node, Configuration config) {
340369
exists(Node n | node.asNode() = n |
@@ -348,10 +377,7 @@ private predicate fullBarrier(NodeEx node, Configuration config) {
348377
not config.isSink(n) and
349378
not config.isSink(n, _)
350379
or
351-
exists(BarrierGuard g |
352-
config.isBarrierGuard(g) and
353-
n = g.getAGuardedNode()
354-
)
380+
any(BarrierGuardGuardedNodeBridge b).guardedNode(n, config)
355381
)
356382
}
357383

@@ -360,10 +386,7 @@ private predicate stateBarrier(NodeEx node, FlowState state, Configuration confi
360386
exists(Node n | node.asNode() = n |
361387
config.isBarrier(n, state)
362388
or
363-
exists(BarrierGuard g |
364-
config.isBarrierGuard(g, state) and
365-
n = g.getAGuardedNode()
366-
)
389+
any(BarrierGuardGuardedNodeBridge b).guardedNode(n, state, config)
367390
)
368391
}
369392

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

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,20 @@ abstract class Configuration extends string {
9090
/** Holds if data flow out of `node` is prohibited. */
9191
predicate isBarrierOut(Node node) { none() }
9292

93-
/** Holds if data flow through nodes guarded by `guard` is prohibited. */
94-
predicate isBarrierGuard(BarrierGuard guard) { none() }
93+
/**
94+
* DEPRECATED: Use `isBarrier` and `BarrierGuard` module instead.
95+
*
96+
* Holds if data flow through nodes guarded by `guard` is prohibited.
97+
*/
98+
deprecated predicate isBarrierGuard(BarrierGuard guard) { none() }
9599

96100
/**
101+
* DEPRECATED: Use `isBarrier` and `BarrierGuard` module instead.
102+
*
97103
* Holds if data flow through nodes guarded by `guard` is prohibited when
98104
* the flow state is `state`
99105
*/
100-
predicate isBarrierGuard(BarrierGuard guard, FlowState state) { none() }
106+
deprecated predicate isBarrierGuard(BarrierGuard guard, FlowState state) { none() }
101107

102108
/**
103109
* Holds if data may flow from `node1` to `node2` in addition to the normal data-flow steps.
@@ -335,6 +341,29 @@ private predicate outBarrier(NodeEx node, Configuration config) {
335341
)
336342
}
337343

344+
/** A bridge class to access the deprecated `isBarrierGuard`. */
345+
private class BarrierGuardGuardedNodeBridge extends Unit {
346+
abstract predicate guardedNode(Node n, Configuration config);
347+
348+
abstract predicate guardedNode(Node n, FlowState state, Configuration config);
349+
}
350+
351+
private class BarrierGuardGuardedNode extends BarrierGuardGuardedNodeBridge {
352+
deprecated override predicate guardedNode(Node n, Configuration config) {
353+
exists(BarrierGuard g |
354+
config.isBarrierGuard(g) and
355+
n = g.getAGuardedNode()
356+
)
357+
}
358+
359+
deprecated override predicate guardedNode(Node n, FlowState state, Configuration config) {
360+
exists(BarrierGuard g |
361+
config.isBarrierGuard(g, state) and
362+
n = g.getAGuardedNode()
363+
)
364+
}
365+
}
366+
338367
pragma[nomagic]
339368
private predicate fullBarrier(NodeEx node, Configuration config) {
340369
exists(Node n | node.asNode() = n |
@@ -348,10 +377,7 @@ private predicate fullBarrier(NodeEx node, Configuration config) {
348377
not config.isSink(n) and
349378
not config.isSink(n, _)
350379
or
351-
exists(BarrierGuard g |
352-
config.isBarrierGuard(g) and
353-
n = g.getAGuardedNode()
354-
)
380+
any(BarrierGuardGuardedNodeBridge b).guardedNode(n, config)
355381
)
356382
}
357383

@@ -360,10 +386,7 @@ private predicate stateBarrier(NodeEx node, FlowState state, Configuration confi
360386
exists(Node n | node.asNode() = n |
361387
config.isBarrier(n, state)
362388
or
363-
exists(BarrierGuard g |
364-
config.isBarrierGuard(g, state) and
365-
n = g.getAGuardedNode()
366-
)
389+
any(BarrierGuardGuardedNodeBridge b).guardedNode(n, state, config)
367390
)
368391
}
369392

0 commit comments

Comments
 (0)