Skip to content

Commit 3dbd480

Browse files
committed
Dataflow: Add Unit type for all languages.
1 parent 9e45f10 commit 3dbd480

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowPrivate.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,15 @@ predicate isUnreachableInCall(Node n, DataFlowCall call) { none() } // stub impl
280280

281281
int accessPathLimit() { result = 5 }
282282

283+
/** The unit type. */
284+
private newtype TUnit = TMkUnit()
285+
286+
/** The trivial type with a single element. */
287+
class Unit extends TUnit {
288+
/** Gets a textual representation of this element. */
289+
string toString() { result = "unit" }
290+
}
291+
283292
/**
284293
* Holds if `n` does not require a `PostUpdateNode` as it either cannot be
285294
* modified or its modification cannot be observed, for example if it is a

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,15 @@ predicate isUnreachableInCall(Node n, DataFlowCall call) { none() } // stub impl
510510

511511
int accessPathLimit() { result = 5 }
512512

513+
/** The unit type. */
514+
private newtype TUnit = TMkUnit()
515+
516+
/** The trivial type with a single element. */
517+
class Unit extends TUnit {
518+
/** Gets a textual representation of this element. */
519+
string toString() { result = "unit" }
520+
}
521+
513522
/**
514523
* Holds if `n` does not require a `PostUpdateNode` as it either cannot be
515524
* modified or its modification cannot be observed, for example if it is a

csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,6 +1932,15 @@ private predicate viableConstantBooleanParamArg(
19321932

19331933
int accessPathLimit() { result = 5 }
19341934

1935+
/** The unit type. */
1936+
private newtype TUnit = TMkUnit()
1937+
1938+
/** The trivial type with a single element. */
1939+
class Unit extends TUnit {
1940+
/** Gets a textual representation of this element. */
1941+
string toString() { result = "unit" }
1942+
}
1943+
19351944
/**
19361945
* Holds if `n` does not require a `PostUpdateNode` as it either cannot be
19371946
* modified or its modification cannot be observed, for example if it is a

python/ql/src/semmle/python/dataflow/new/internal/DataFlowPrivate.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,5 +1150,14 @@ predicate isImmutableOrUnobservable(Node n) { none() }
11501150

11511151
int accessPathLimit() { result = 5 }
11521152

1153+
/** The unit type. */
1154+
private newtype TUnit = TMkUnit()
1155+
1156+
/** The trivial type with a single element. */
1157+
class Unit extends TUnit {
1158+
/** Gets a textual representation of this element. */
1159+
string toString() { result = "unit" }
1160+
}
1161+
11531162
/** Holds if `n` should be hidden from path explanations. */
11541163
predicate nodeIsHidden(Node n) { none() }

0 commit comments

Comments
 (0)