Skip to content

Commit de3dc73

Browse files
committed
C++: Follow-up changes
1 parent 1fa58bd commit de3dc73

File tree

8 files changed

+16
-32
lines changed

8 files changed

+16
-32
lines changed

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -223,17 +223,13 @@ predicate clearsContent(Node n, Content c) {
223223
none() // stub implementation
224224
}
225225

226-
/**
227-
* Gets a representative (boxed) type for `t` for the purpose of pruning
228-
* possible flow. A single type is used for all numeric types to account for
229-
* numeric conversions, and otherwise the erasure is used.
230-
*/
231-
Type getErasedRepr(Type t) {
232-
suppressUnusedType(t) and
226+
/** Gets the type of `n` used for type pruning. */
227+
Type getNodeType(Node n) {
228+
suppressUnusedNode(n) and
233229
result instanceof VoidType // stub implementation
234230
}
235231

236-
/** Gets a string representation of a type returned by `getErasedRepr`. */
232+
/** Gets a string representation of a type returned by `getNodeType`. */
237233
string ppReprType(Type t) { none() } // stub implementation
238234

239235
/**
@@ -245,7 +241,7 @@ predicate compatibleTypes(Type t1, Type t2) {
245241
any() // stub implementation
246242
}
247243

248-
private predicate suppressUnusedType(Type t) { any() }
244+
private predicate suppressUnusedNode(Node n) { any() }
249245

250246
//////////////////////////////////////////////////////////////////////////////
251247
// Java QL library compatibility wrappers

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,17 +233,13 @@ predicate clearsContent(Node n, Content c) {
233233
none() // stub implementation
234234
}
235235

236-
/**
237-
* Gets a representative (boxed) type for `t` for the purpose of pruning
238-
* possible flow. A single type is used for all numeric types to account for
239-
* numeric conversions, and otherwise the erasure is used.
240-
*/
241-
Type getErasedRepr(Type t) {
242-
suppressUnusedType(t) and
236+
/** Gets the type of `n` used for type pruning. */
237+
Type getNodeType(Node n) {
238+
suppressUnusedNode(n) and
243239
result instanceof VoidType // stub implementation
244240
}
245241

246-
/** Gets a string representation of a type returned by `getErasedRepr`. */
242+
/** Gets a string representation of a type returned by `getNodeType`. */
247243
string ppReprType(Type t) { none() } // stub implementation
248244

249245
/**
@@ -255,7 +251,7 @@ predicate compatibleTypes(Type t1, Type t2) {
255251
any() // stub implementation
256252
}
257253

258-
private predicate suppressUnusedType(Type t) { any() }
254+
private predicate suppressUnusedNode(Node n) { any() }
259255

260256
//////////////////////////////////////////////////////////////////////////////
261257
// Java QL library compatibility wrappers

cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-consistency.expected

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
uniqueEnclosingCallable
2-
uniqueTypeBound
3-
uniqueTypeRepr
2+
uniqueType
43
uniqueNodeLocation
54
missingLocation
65
uniqueNodeToString

cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-ir-consistency.expected

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
uniqueEnclosingCallable
2-
uniqueTypeBound
3-
uniqueTypeRepr
2+
uniqueType
43
uniqueNodeLocation
54
| BarrierGuard.cpp:2:11:2:13 | p#0 | Node should have one location but has 6. |
65
| acrossLinkTargets.cpp:2:11:2:13 | p#0 | Node should have one location but has 6. |

cpp/ql/test/library-tests/dataflow/fields/dataflow-consistency.expected

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
uniqueEnclosingCallable
22
| C.cpp:37:24:37:33 | 0 | Node should have one enclosing callable but has 0. |
33
| C.cpp:37:24:37:33 | new | Node should have one enclosing callable but has 0. |
4-
uniqueTypeBound
5-
uniqueTypeRepr
4+
uniqueType
65
uniqueNodeLocation
76
missingLocation
87
uniqueNodeToString

cpp/ql/test/library-tests/dataflow/fields/dataflow-ir-consistency.expected

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
uniqueEnclosingCallable
2-
uniqueTypeBound
3-
uniqueTypeRepr
2+
uniqueType
43
uniqueNodeLocation
54
| D.cpp:1:17:1:17 | o | Node should have one location but has 3. |
65
| by_reference.cpp:1:17:1:17 | o | Node should have one location but has 3. |

cpp/ql/test/library-tests/syntax-zoo/dataflow-consistency.expected

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ uniqueEnclosingCallable
88
| misc.c:210:24:210:24 | 0 | Node should have one enclosing callable but has 0. |
99
| misc.c:210:24:210:28 | ... + ... | Node should have one enclosing callable but has 0. |
1010
| misc.c:210:28:210:28 | 1 | Node should have one enclosing callable but has 0. |
11-
uniqueTypeBound
12-
| cpp17.cpp:15:5:15:45 | call to unknown function | Node should have one type bound but has 0. |
13-
uniqueTypeRepr
14-
| cpp17.cpp:15:5:15:45 | call to unknown function | Node should have one type representation but has 0. |
11+
uniqueType
1512
uniqueNodeLocation
1613
| break_labels.c:2:11:2:11 | i | Node should have one location but has 4. |
1714
| break_labels.c:2:11:2:11 | x | Node should have one location but has 4. |

cpp/ql/test/library-tests/syntax-zoo/dataflow-ir-consistency.expected

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
uniqueEnclosingCallable
2-
uniqueTypeBound
3-
uniqueTypeRepr
2+
uniqueType
43
uniqueNodeLocation
54
| aggregateinitializer.c:1:6:1:6 | AliasedDefinition | Node should have one location but has 20. |
65
| aggregateinitializer.c:1:6:1:6 | AliasedUse | Node should have one location but has 20. |

0 commit comments

Comments
 (0)