Skip to content

Commit fc444f1

Browse files
committed
Merge branch 'main' into unusedvar8
2 parents df7bcfd + 9b6c967 commit fc444f1

File tree

314 files changed

+22517
-21475
lines changed

Some content is hidden

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

314 files changed

+22517
-21475
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"omnisharp.autoStart": false,
33
"cmake.sourceDirectory": "${workspaceFolder}/swift",
4-
"cmake.buildDirectory": "${workspaceFolder}/bazel-cmake-build"
4+
"cmake.buildDirectory": "${workspaceFolder}/bazel-cmake-build",
5+
"editor.suggest.matchOnWordStartOnly": false
56
}

cpp/ql/lib/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## 2.1.0
2+
3+
### New Features
4+
5+
* Added a new predicate `DataFlow::getARuntimeTarget` for getting a function that may be invoked by a `Call` expression. Unlike `Call.getTarget` this new predicate may also resolve function pointers.
6+
* Added the predicate `mayBeFromImplicitlyDeclaredFunction()` to the `Call` class to represent calls that may be the return value of an implicitly declared C function.
7+
* Added the predicate `getAnExplicitDeclarationEntry()` to the `Function` class to get a `FunctionDeclarationEntry` that is not implicit.
8+
* Added classes `RequiresExpr`, `SimpleRequirementExpr`, `TypeRequirementExpr`, `CompoundRequirementExpr`, and `NestedRequirementExpr` to represent C++20 requires expressions and the simple, type, compound, and nested requirements that can occur in `requires` expressions.
9+
10+
### Minor Analysis Improvements
11+
12+
* The function call target resolution algorithm has been improved to resolve more calls through function pointers. As a result, dataflow queries may have more results.
13+
114
## 2.0.2
215

316
### Minor Analysis Improvements

cpp/ql/lib/change-notes/2014-10-11-requires-expressions.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

cpp/ql/lib/change-notes/2014-10-16-implicitly-declared-fns.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

cpp/ql/lib/change-notes/2024-10-16-function-pointer-resolution.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

cpp/ql/lib/change-notes/2024-10-16-new-api-for-call-target-resolution.md

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## 2.1.0
2+
3+
### New Features
4+
5+
* Added a new predicate `DataFlow::getARuntimeTarget` for getting a function that may be invoked by a `Call` expression. Unlike `Call.getTarget` this new predicate may also resolve function pointers.
6+
* Added the predicate `mayBeFromImplicitlyDeclaredFunction()` to the `Call` class to represent calls that may be the return value of an implicitly declared C function.
7+
* Added the predicate `getAnExplicitDeclarationEntry()` to the `Function` class to get a `FunctionDeclarationEntry` that is not implicit.
8+
* Added classes `RequiresExpr`, `SimpleRequirementExpr`, `TypeRequirementExpr`, `CompoundRequirementExpr`, and `NestedRequirementExpr` to represent C++20 requires expressions and the simple, type, compound, and nested requirements that can occur in `requires` expressions.
9+
10+
### Minor Analysis Improvements
11+
12+
* The function call target resolution algorithm has been improved to resolve more calls through function pointers. As a result, dataflow queries may have more results.

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: 2.0.2
2+
lastReleaseVersion: 2.1.0

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: 2.0.3-dev
2+
version: 2.1.1-dev
33
groups: cpp
44
dbscheme: semmlecode.cpp.dbscheme
55
extractor: cpp

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ private module Input implements TypeFlowInput<Location> {
159159
)
160160
}
161161

162-
predicate joinStep(TypeFlowNode n1, TypeFlowNode n2) {
162+
predicate step(TypeFlowNode n1, TypeFlowNode n2) {
163163
// instruction -> phi
164164
getAnUltimateLocalDefinition(n2.asInstruction()) = n1.asInstruction()
165165
or
@@ -179,6 +179,8 @@ private module Input implements TypeFlowInput<Location> {
179179
n1.asInstruction() = arg and
180180
n2.asInstruction() = p
181181
)
182+
or
183+
instructionStep(n1.asInstruction(), n2.asInstruction())
182184
}
183185

184186
/**
@@ -199,10 +201,6 @@ private module Input implements TypeFlowInput<Location> {
199201
i2.(PointerArithmeticInstruction).getLeft() = i1
200202
}
201203

202-
predicate step(TypeFlowNode n1, TypeFlowNode n2) {
203-
instructionStep(n1.asInstruction(), n2.asInstruction())
204-
}
205-
206204
predicate isNullValue(TypeFlowNode n) { n.isNullValue() }
207205

208206
private newtype TType =
@@ -245,11 +243,7 @@ private module Input implements TypeFlowInput<Location> {
245243

246244
pragma[nomagic]
247245
private predicate upcastCand(TypeFlowNode n, Type t1, Type t2) {
248-
exists(TypeFlowNode next |
249-
step(n, next)
250-
or
251-
joinStep(n, next)
252-
|
246+
exists(TypeFlowNode next | step(n, next) |
253247
n.getType() = t1 and
254248
next.getType() = t2 and
255249
t1 != t2

0 commit comments

Comments
 (0)