Skip to content

Commit 57ec5db

Browse files
authored
Merge branch 'main' into redsun82/swift-linkage-awareness
2 parents f383fd1 + e6aebd9 commit 57ec5db

File tree

49 files changed

+11539
-1868
lines changed

Some content is hidden

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

49 files changed

+11539
-1868
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ module Consistency {
4545
) {
4646
none()
4747
}
48+
49+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodeAtPosition`. */
50+
predicate uniqueParameterNodeAtPositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
51+
none()
52+
}
53+
54+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodePosition`. */
55+
predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
56+
none()
57+
}
4858
}
4959

5060
private class RelevantNode extends Node {
@@ -246,6 +256,7 @@ module Consistency {
246256
query predicate uniqueParameterNodeAtPosition(
247257
DataFlowCallable c, ParameterPosition pos, Node p, string msg
248258
) {
259+
not any(ConsistencyConfiguration conf).uniqueParameterNodeAtPositionExclude(c, pos, p) and
249260
isParameterNode(p, c, pos) and
250261
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
251262
msg = "Parameters with overlapping positions."
@@ -254,6 +265,7 @@ module Consistency {
254265
query predicate uniqueParameterNodePosition(
255266
DataFlowCallable c, ParameterPosition pos, Node p, string msg
256267
) {
268+
not any(ConsistencyConfiguration conf).uniqueParameterNodePositionExclude(c, pos, p) and
257269
isParameterNode(p, c, pos) and
258270
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
259271
msg = "Parameter node with multiple positions."
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
private import RangeAnalysisStage
2+
3+
module FloatDelta implements DeltaSig {
4+
class Delta = float;
5+
6+
bindingset[d]
7+
bindingset[result]
8+
float toFloat(Delta d) { result = d }
9+
10+
bindingset[d]
11+
bindingset[result]
12+
int toInt(Delta d) { result = d }
13+
14+
bindingset[n]
15+
bindingset[result]
16+
Delta fromInt(int n) { result = n }
17+
18+
bindingset[f]
19+
Delta fromFloat(float f) {
20+
result =
21+
min(float diff, float res |
22+
diff = (res - f) and res = f.ceil()
23+
or
24+
diff = (f - res) and res = f.floor()
25+
|
26+
res order by diff
27+
)
28+
}
29+
}

0 commit comments

Comments
 (0)