Skip to content

Commit 78ad9ba

Browse files
authored
Merge pull request github#11262 from rdmarsh2/rdmarsh2/cpp/deprecate-ast-gvn
C++: deprecate AST-based GVN
2 parents f7fc61e + 752bc2e commit 78ad9ba

File tree

5 files changed

+17
-2
lines changed

5 files changed

+17
-2
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
category: deprecated
3+
---
4+
5+
6+
* Deprecated `semmle.code.cpp.valuenumbering.GlobalValueNumberingImpl`. Use `semmle.code.cpp.valuenumbering.GlobalValueNumbering`, which exposes the same API.

cpp/ql/lib/semmle/code/cpp/valuenumbering/GlobalValueNumberingImpl.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
/**
2+
* DEPRECATED: This library has been replaced with a newer version which
3+
* provides better performance and precision. Use
4+
* `semmle.code.cpp.valuenumbering.GlobalValueNumbering` instead.
5+
*
26
* Provides an implementation of Global Value Numbering.
37
* See https://en.wikipedia.org/wiki/Global_value_numbering
48
*
@@ -221,7 +225,7 @@ private newtype GvnBase =
221225
* expression with this `GVN` and using its `toString` and `getLocation`
222226
* methods.
223227
*/
224-
class GVN extends GvnBase {
228+
deprecated class GVN extends GvnBase {
225229
GVN() { this instanceof GvnBase }
226230

227231
/** Gets an expression that has this GVN. */
@@ -503,7 +507,7 @@ private predicate mk_Deref(GVN p, ControlFlowNode dominator, PointerDereferenceE
503507

504508
/** Gets the global value number of expression `e`. */
505509
cached
506-
GVN globalValueNumber(Expr e) {
510+
deprecated GVN globalValueNumber(Expr e) {
507511
exists(int val, Type t |
508512
mk_IntConst(val, t, e) and
509513
result = GVN_IntConst(val, t)

cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_gvn.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
WARNING: Type GVN has been deprecated and may be removed in future (ast_gvn.ql:4,6-9)
12
| test.cpp:5:3:5:3 | x | 5:c3-c3 6:c3-c3 |
23
| test.cpp:5:7:5:8 | p0 | 5:c7-c8 6:c7-c8 |
34
| test.cpp:5:7:5:13 | ... + ... | 5:c7-c13 6:c7-c13 7:c7-c7 |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
WARNING: Predicate globalValueNumber has been deprecated and may be removed in future (ast_uniqueness.ql:7,13-30)
2+
WARNING: Predicate globalValueNumber has been deprecated and may be removed in future (ast_uniqueness.ql:8,30-47)
3+
WARNING: Type GVN has been deprecated and may be removed in future (ast_uniqueness.ql:8,18-21)

cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/diff_ir_expr.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
WARNING: Predicate globalValueNumber has been deprecated and may be removed in future (diff_ir_expr.ql:8,29-51)
12
| test.cpp:5:3:5:13 | ... = ... | test.cpp:5:3:5:13 | ... = ... | AST only |
23
| test.cpp:6:3:6:13 | ... = ... | test.cpp:6:3:6:13 | ... = ... | AST only |
34
| test.cpp:7:3:7:7 | ... = ... | test.cpp:7:3:7:7 | ... = ... | AST only |

0 commit comments

Comments
 (0)