diff --git a/cpp/ql/lib/change-notes/2024-04-26-outdated-deprecations.md b/cpp/ql/lib/change-notes/2024-04-26-outdated-deprecations.md new file mode 100644 index 000000000000..642e3443640a --- /dev/null +++ b/cpp/ql/lib/change-notes/2024-04-26-outdated-deprecations.md @@ -0,0 +1,4 @@ +--- +category: breaking +--- +* Deleted the deprecated `GlobalValueNumberingImpl.qll` implementation. diff --git a/cpp/ql/lib/semmle/code/cpp/valuenumbering/GlobalValueNumberingImpl.qll b/cpp/ql/lib/semmle/code/cpp/valuenumbering/GlobalValueNumberingImpl.qll deleted file mode 100644 index 8f43e19c7b55..000000000000 --- a/cpp/ql/lib/semmle/code/cpp/valuenumbering/GlobalValueNumberingImpl.qll +++ /dev/null @@ -1,616 +0,0 @@ -/** - * DEPRECATED: This library has been replaced with a newer version which - * provides better performance and precision. Use - * `semmle.code.cpp.valuenumbering.GlobalValueNumbering` instead. - * - * Provides an implementation of Global Value Numbering. - * See https://en.wikipedia.org/wiki/Global_value_numbering - * - * The predicate `globalValueNumber` converts an expression into a `GVN`, - * which is an abstract type representing the value of the expression. If - * two expressions have the same `GVN` then they compute the same value. - * For example: - * - * ``` - * void f(int x, int y) { - * g(x+y, x+y); - * } - * ``` - * - * In this example, both arguments in the call to `g` compute the same value, - * so both arguments have the same `GVN`. In other words, we can find - * this call with the following query: - * - * ``` - * from FunctionCall call, GVN v - * where v = globalValueNumber(call.getArgument(0)) - * and v = globalValueNumber(call.getArgument(1)) - * select call - * ``` - * - * The analysis is conservative, so two expressions might have different - * `GVN`s even though the actually always compute the same value. The most - * common reason for this is that the analysis cannot prove that there - * are no side-effects that might cause the computed value to change. - */ - -/* - * Note to developers: the correctness of this module depends on the - * definitions of GVN, globalValueNumber, and analyzableExpr being kept in - * sync with each other. If you change this module then make sure that the - * change is symmetric across all three. - */ - -import cpp -private import semmle.code.cpp.controlflow.SSA - -/** - * Holds if the result is a control flow node that might change the - * value of any global variable. This is used in the implementation - * of `GVN_OtherVariable`, because we need to be quite conservative when - * we assign a value number to a global variable. For example: - * - * ``` - * x = g+1; - * dosomething(); - * y = g+1; - * ``` - * - * It is not safe to assign the same value number to both instances - * of `g+1` in this example, because the call to `dosomething` might - * change the value of `g`. - */ -private ControlFlowNode nodeWithPossibleSideEffect() { - result instanceof Call - or - // If the lhs of an assignment is not analyzable by SSA, then - // we need to treat the assignment as having a possible side-effect. - result instanceof Assignment and not result instanceof SsaDefinition - or - result instanceof CrementOperation and not result instanceof SsaDefinition - or - exists(LocalVariable v | - result = v.getInitializer().getExpr() and not result instanceof SsaDefinition - ) - or - result instanceof AsmStmt -} - -/** - * Gets the entry node of the control flow graph of which `node` is a - * member. - */ -cached -private ControlFlowNode getControlFlowEntry(ControlFlowNode node) { - result = node.getControlFlowScope().getEntryPoint() and - result.getASuccessor*() = node -} - -/** - * Holds if there is a control flow edge from `src` to `dst` or - * if `dst` is an expression with a possible side-effect. The idea - * is to treat side effects as entry points in the control flow - * graph so that we can use the dominator tree to find the most recent - * side-effect. - */ -private predicate sideEffectCfg(ControlFlowNode src, ControlFlowNode dst) { - src.getASuccessor() = dst - or - // Add an edge from the entry point to any node that might have a side - // effect. - dst = nodeWithPossibleSideEffect() and - src = getControlFlowEntry(dst) -} - -/** - * Holds if `dominator` is the immediate dominator of `node` in - * the side-effect CFG. - */ -private predicate iDomEffect(ControlFlowNode dominator, ControlFlowNode node) = - idominance(functionEntry/1, sideEffectCfg/2)(_, dominator, node) - -/** - * Gets the most recent side effect. To be more precise, `result` is a - * dominator of `node` and no side-effects can occur between `result` and - * `node`. - * - * `sideEffectCFG` has an edge from the function entry to every node with a - * side-effect. This means that every node with a side-effect has the - * function entry as its immediate dominator. So if node `x` dominates node - * `y` then there can be no side effects between `x` and `y` unless `x` is - * the function entry. So the optimal choice for `result` has the function - * entry as its immediate dominator. - * - * Example: - * - * ``` - * 000: int f(int a, int b, int *p) { - * 001: int r = 0; - * 002: if (a) { - * 003: if (b) { - * 004: sideEffect1(); - * 005: } - * 006: } else { - * 007: sideEffect2(); - * 008: } - * 009: if (a) { - * 010: r++; // Not a side-effect, because r is an SSA variable. - * 011: } - * 012: if (b) { - * 013: r++; // Not a side-effect, because r is an SSA variable. - * 014: } - * 015: return *p; - * 016: } - * ``` - * - * Suppose we want to find the most recent side-effect for the dereference - * of `p` on line 015. The `sideEffectCFG` has an edge from the function - * entry (line 000) to the side effects at lines 004 and 007. Therefore, - * the immediate dominator tree looks like this: - * - * 000 - 001 - 002 - 003 - * - 004 - * - 007 - * - 009 - 010 - * - 012 - 013 - * - 015 - * - * The immediate dominator path to line 015 is 000 - 009 - 012 - 015. - * Therefore, the most recent side effect for line 015 is line 009. - */ -cached -private ControlFlowNode mostRecentSideEffect(ControlFlowNode node) { - exists(ControlFlowNode entry | - functionEntry(entry) and - iDomEffect(entry, result) and - iDomEffect*(result, node) - ) -} - -/** Used to represent the "global value number" of an expression. */ -cached -private newtype GvnBase = - GVN_IntConst(int val, Type t) { mk_IntConst(val, t, _) } or - GVN_FloatConst(float val, Type t) { mk_FloatConst(val, t, _) } or - // If the local variable does not have a defining value, then - // we use the SsaDefinition as its global value number. - GVN_UndefinedStackVariable(StackVariable x, SsaDefinition def) { - mk_UndefinedStackVariable(x, def, _) - } or - // Variables with no SSA information. As a crude (but safe) - // approximation, we use `mostRecentSideEffect` to compute a definition - // location for the variable. This ensures that two instances of the same - // global variable will only get the same value number if they are - // guaranteed to have the same value. - GVN_OtherVariable(Variable x, ControlFlowNode dominator) { mk_OtherVariable(x, dominator, _) } or - deprecated GVN_FieldAccess(GVN s, Field f) { - mk_DotFieldAccess(s, f, _) or - mk_PointerFieldAccess_with_deref(s, f, _) or - mk_ImplicitThisFieldAccess_with_deref(s, f, _) - } or - // Dereference a pointer. The value might have changed since the last - // time the pointer was dereferenced, so we need to include a definition - // location. As a crude (but safe) approximation, we use - // `mostRecentSideEffect` to compute a definition location. - deprecated GVN_Deref(GVN p, ControlFlowNode dominator) { - mk_Deref(p, dominator, _) or - mk_PointerFieldAccess(p, _, dominator, _) or - mk_ImplicitThisFieldAccess_with_qualifier(p, _, dominator, _) - } or - GVN_ThisExpr(Function fcn) { - mk_ThisExpr(fcn, _) or - mk_ImplicitThisFieldAccess(fcn, _, _, _) - } or - deprecated GVN_Conversion(Type t, GVN child) { mk_Conversion(t, child, _) } or - deprecated GVN_BinaryOp(GVN lhs, GVN rhs, string opname) { mk_BinaryOp(lhs, rhs, opname, _) } or - deprecated GVN_UnaryOp(GVN child, string opname) { mk_UnaryOp(child, opname, _) } or - deprecated GVN_ArrayAccess(GVN x, GVN i, ControlFlowNode dominator) { - mk_ArrayAccess(x, i, dominator, _) - } or - // Any expression that is not handled by the cases above is - // given a unique number based on the expression itself. - GVN_Unanalyzable(Expr e) { not analyzableExpr(e) } - -/** - * A Global Value Number. A GVN is an abstract representation of the value - * computed by an expression. The relationship between `Expr` and `GVN` is - * many-to-one: every `Expr` has exactly one `GVN`, but multiple - * expressions can have the same `GVN`. If two expressions have the same - * `GVN`, it means that they compute the same value at run time. The `GVN` - * is an opaque value, so you cannot deduce what the run-time value of an - * expression will be from its `GVN`. The only use for the `GVN` of an - * expression is to find other expressions that compute the same value. - * Use the predicate `globalValueNumber` to get the `GVN` for an `Expr`. - * - * Note: `GVN` has `toString` and `getLocation` methods, so that it can be - * displayed in a results list. These work by picking an arbitrary - * expression with this `GVN` and using its `toString` and `getLocation` - * methods. - */ -deprecated class GVN extends GvnBase { - GVN() { this instanceof GvnBase } - - /** Gets an expression that has this GVN. */ - Expr getAnExpr() { this = globalValueNumber(result) } - - /** Gets the kind of the GVN. This can be useful for debugging. */ - string getKind() { - if this instanceof GVN_IntConst - then result = "IntConst" - else - if this instanceof GVN_FloatConst - then result = "FloatConst" - else - if this instanceof GVN_UndefinedStackVariable - then result = "UndefinedStackVariable" - else - if this instanceof GVN_OtherVariable - then result = "OtherVariable" - else - if this instanceof GVN_FieldAccess - then result = "FieldAccess" - else - if this instanceof GVN_Deref - then result = "Deref" - else - if this instanceof GVN_ThisExpr - then result = "ThisExpr" - else - if this instanceof GVN_Conversion - then result = "Conversion" - else - if this instanceof GVN_BinaryOp - then result = "BinaryOp" - else - if this instanceof GVN_UnaryOp - then result = "UnaryOp" - else - if this instanceof GVN_ArrayAccess - then result = "ArrayAccess" - else - if this instanceof GVN_Unanalyzable - then result = "Unanalyzable" - else result = "error" - } - - /** - * Gets an example of an expression with this GVN. - * This is useful for things like implementing toString(). - */ - private Expr exampleExpr() { - // Pick the expression with the minimum source location string. This is - // just an arbitrary way to pick an expression with this `GVN`. - result = min(Expr e | this = globalValueNumber(e) | e order by e.getLocation().toString()) - } - - /** Gets a textual representation of this element. */ - string toString() { result = this.exampleExpr().toString() } - - /** Gets the primary location of this element. */ - Location getLocation() { result = this.exampleExpr().getLocation() } -} - -private predicate analyzableIntConst(Expr e) { - strictcount(e.getValue().toInt()) = 1 and - strictcount(e.getUnspecifiedType()) = 1 -} - -private predicate mk_IntConst(int val, Type t, Expr e) { - analyzableIntConst(e) and - val = e.getValue().toInt() and - t = e.getUnspecifiedType() -} - -private predicate analyzableFloatConst(Expr e) { - strictcount(e.getValue().toFloat()) = 1 and - strictcount(e.getUnspecifiedType()) = 1 and - not analyzableIntConst(e) -} - -private predicate mk_FloatConst(float val, Type t, Expr e) { - analyzableFloatConst(e) and - val = e.getValue().toFloat() and - t = e.getUnspecifiedType() -} - -private predicate analyzableStackVariable(VariableAccess access) { - strictcount(SsaDefinition def | def.getAUse(_) = access | def) = 1 and - strictcount(SsaDefinition def, Variable v | def.getAUse(v) = access | v) = 1 and - count(SsaDefinition def, Variable v | - def.getAUse(v) = access - | - def.getDefiningValue(v).getFullyConverted() - ) <= 1 and - not analyzableConst(access) -} - -// Note: this predicate only has a result if the access has no -// defining value. If there is a defining value, then there is no -// need to generate a fresh `GVN` for the access because `globalValueNumber` -// will follow the chain and use the GVN of the defining value. -private predicate mk_UndefinedStackVariable( - StackVariable x, SsaDefinition def, VariableAccess access -) { - analyzableStackVariable(access) and - access = def.getAUse(x) and - not exists(def.getDefiningValue(x)) -} - -private predicate analyzableDotFieldAccess(DotFieldAccess access) { - strictcount(access.getTarget()) = 1 and - strictcount(access.getQualifier().getFullyConverted()) = 1 and - not analyzableConst(access) -} - -deprecated private predicate mk_DotFieldAccess(GVN qualifier, Field target, DotFieldAccess access) { - analyzableDotFieldAccess(access) and - target = access.getTarget() and - qualifier = globalValueNumber(access.getQualifier().getFullyConverted()) -} - -private predicate analyzablePointerFieldAccess(PointerFieldAccess access) { - strictcount(mostRecentSideEffect(access)) = 1 and - strictcount(access.getTarget()) = 1 and - strictcount(access.getQualifier().getFullyConverted()) = 1 and - not analyzableConst(access) -} - -deprecated private predicate mk_PointerFieldAccess( - GVN qualifier, Field target, ControlFlowNode dominator, PointerFieldAccess access -) { - analyzablePointerFieldAccess(access) and - dominator = mostRecentSideEffect(access) and - target = access.getTarget() and - qualifier = globalValueNumber(access.getQualifier().getFullyConverted()) -} - -/** - * `obj->field` is equivalent to `(*obj).field`, so we need to wrap an - * extra `GVN_Deref` around the qualifier. - */ -deprecated private predicate mk_PointerFieldAccess_with_deref( - GVN new_qualifier, Field target, PointerFieldAccess access -) { - exists(GVN qualifier, ControlFlowNode dominator | - mk_PointerFieldAccess(qualifier, target, dominator, access) and - new_qualifier = GVN_Deref(qualifier, dominator) - ) -} - -private predicate analyzableImplicitThisFieldAccess(ImplicitThisFieldAccess access) { - strictcount(mostRecentSideEffect(access)) = 1 and - strictcount(access.getTarget()) = 1 and - strictcount(access.getEnclosingFunction()) = 1 and - not analyzableConst(access) -} - -private predicate mk_ImplicitThisFieldAccess( - Function fcn, Field target, ControlFlowNode dominator, ImplicitThisFieldAccess access -) { - analyzableImplicitThisFieldAccess(access) and - dominator = mostRecentSideEffect(access) and - target = access.getTarget() and - fcn = access.getEnclosingFunction() -} - -deprecated private predicate mk_ImplicitThisFieldAccess_with_qualifier( - GVN qualifier, Field target, ControlFlowNode dominator, ImplicitThisFieldAccess access -) { - exists(Function fcn | - mk_ImplicitThisFieldAccess(fcn, target, dominator, access) and - qualifier = GVN_ThisExpr(fcn) - ) -} - -deprecated private predicate mk_ImplicitThisFieldAccess_with_deref( - GVN new_qualifier, Field target, ImplicitThisFieldAccess access -) { - exists(GVN qualifier, ControlFlowNode dominator | - mk_ImplicitThisFieldAccess_with_qualifier(qualifier, target, dominator, access) and - new_qualifier = GVN_Deref(qualifier, dominator) - ) -} - -/** - * Holds if `access` is an access of a variable that does - * not have SSA information. (For example, because the variable - * is global.) - */ -private predicate analyzableOtherVariable(VariableAccess access) { - not access instanceof FieldAccess and - not exists(SsaDefinition def | access = def.getAUse(_)) and - strictcount(access.getTarget()) = 1 and - strictcount(mostRecentSideEffect(access)) = 1 and - not analyzableConst(access) -} - -private predicate mk_OtherVariable(Variable x, ControlFlowNode dominator, VariableAccess access) { - analyzableOtherVariable(access) and - x = access.getTarget() and - dominator = mostRecentSideEffect(access) -} - -private predicate analyzableConversion(Conversion conv) { - strictcount(conv.getUnspecifiedType()) = 1 and - strictcount(conv.getExpr()) = 1 and - not analyzableConst(conv) -} - -deprecated private predicate mk_Conversion(Type t, GVN child, Conversion conv) { - analyzableConversion(conv) and - t = conv.getUnspecifiedType() and - child = globalValueNumber(conv.getExpr()) -} - -private predicate analyzableBinaryOp(BinaryOperation op) { - op.isPure() and - strictcount(op.getLeftOperand().getFullyConverted()) = 1 and - strictcount(op.getRightOperand().getFullyConverted()) = 1 and - strictcount(op.getOperator()) = 1 and - not analyzableConst(op) -} - -deprecated private predicate mk_BinaryOp(GVN lhs, GVN rhs, string opname, BinaryOperation op) { - analyzableBinaryOp(op) and - lhs = globalValueNumber(op.getLeftOperand().getFullyConverted()) and - rhs = globalValueNumber(op.getRightOperand().getFullyConverted()) and - opname = op.getOperator() -} - -private predicate analyzableUnaryOp(UnaryOperation op) { - not op instanceof PointerDereferenceExpr and - op.isPure() and - strictcount(op.getOperand().getFullyConverted()) = 1 and - strictcount(op.getOperator()) = 1 and - not analyzableConst(op) -} - -deprecated private predicate mk_UnaryOp(GVN child, string opname, UnaryOperation op) { - analyzableUnaryOp(op) and - child = globalValueNumber(op.getOperand().getFullyConverted()) and - opname = op.getOperator() -} - -private predicate analyzableThisExpr(ThisExpr thisExpr) { - strictcount(thisExpr.getEnclosingFunction()) = 1 and - not analyzableConst(thisExpr) -} - -private predicate mk_ThisExpr(Function fcn, ThisExpr thisExpr) { - analyzableThisExpr(thisExpr) and - fcn = thisExpr.getEnclosingFunction() -} - -private predicate analyzableArrayAccess(ArrayExpr ae) { - strictcount(ae.getArrayBase().getFullyConverted()) = 1 and - strictcount(ae.getArrayOffset().getFullyConverted()) = 1 and - strictcount(mostRecentSideEffect(ae)) = 1 and - not analyzableConst(ae) -} - -deprecated private predicate mk_ArrayAccess( - GVN base, GVN offset, ControlFlowNode dominator, ArrayExpr ae -) { - analyzableArrayAccess(ae) and - base = globalValueNumber(ae.getArrayBase().getFullyConverted()) and - offset = globalValueNumber(ae.getArrayOffset().getFullyConverted()) and - dominator = mostRecentSideEffect(ae) -} - -private predicate analyzablePointerDereferenceExpr(PointerDereferenceExpr deref) { - strictcount(deref.getOperand().getFullyConverted()) = 1 and - strictcount(mostRecentSideEffect(deref)) = 1 and - not analyzableConst(deref) -} - -deprecated private predicate mk_Deref(GVN p, ControlFlowNode dominator, PointerDereferenceExpr deref) { - analyzablePointerDereferenceExpr(deref) and - p = globalValueNumber(deref.getOperand().getFullyConverted()) and - dominator = mostRecentSideEffect(deref) -} - -/** Gets the global value number of expression `e`. */ -cached -deprecated GVN globalValueNumber(Expr e) { - exists(int val, Type t | - mk_IntConst(val, t, e) and - result = GVN_IntConst(val, t) - ) - or - exists(float val, Type t | - mk_FloatConst(val, t, e) and - result = GVN_FloatConst(val, t) - ) - or - // Local variable with a defining value. - exists(StackVariable x, SsaDefinition def | - analyzableStackVariable(e) and - e = def.getAUse(x) and - result = globalValueNumber(def.getDefiningValue(x).getFullyConverted()) - ) - or - // Local variable without a defining value. - exists(StackVariable x, SsaDefinition def | - mk_UndefinedStackVariable(x, def, e) and - result = GVN_UndefinedStackVariable(x, def) - ) - or - // Variable with no SSA information. - exists(Variable x, ControlFlowNode dominator | - mk_OtherVariable(x, dominator, e) and - result = GVN_OtherVariable(x, dominator) - ) - or - exists(GVN qualifier, Field target | - mk_DotFieldAccess(qualifier, target, e) and - result = GVN_FieldAccess(qualifier, target) - ) - or - exists(GVN qualifier, Field target | - mk_PointerFieldAccess_with_deref(qualifier, target, e) and - result = GVN_FieldAccess(qualifier, target) - ) - or - exists(GVN qualifier, Field target | - mk_ImplicitThisFieldAccess_with_deref(qualifier, target, e) and - result = GVN_FieldAccess(qualifier, target) - ) - or - exists(Function fcn | - mk_ThisExpr(fcn, e) and - result = GVN_ThisExpr(fcn) - ) - or - exists(Type t, GVN child | - mk_Conversion(t, child, e) and - result = GVN_Conversion(t, child) - ) - or - exists(GVN lhs, GVN rhs, string opname | - mk_BinaryOp(lhs, rhs, opname, e) and - result = GVN_BinaryOp(lhs, rhs, opname) - ) - or - exists(GVN child, string opname | - mk_UnaryOp(child, opname, e) and - result = GVN_UnaryOp(child, opname) - ) - or - exists(GVN x, GVN i, ControlFlowNode dominator | - mk_ArrayAccess(x, i, dominator, e) and - result = GVN_ArrayAccess(x, i, dominator) - ) - or - exists(GVN p, ControlFlowNode dominator | - mk_Deref(p, dominator, e) and - result = GVN_Deref(p, dominator) - ) - or - not analyzableExpr(e) and result = GVN_Unanalyzable(e) -} - -private predicate analyzableConst(Expr e) { - analyzableIntConst(e) or - analyzableFloatConst(e) -} - -/** - * Holds if the expression is explicitly handled by `globalValueNumber`. - * Unanalyzable expressions still need to be given a global value number, - * but it will be a unique number that is not shared with any other - * expression. - */ -private predicate analyzableExpr(Expr e) { - analyzableConst(e) or - analyzableStackVariable(e) or - analyzableDotFieldAccess(e) or - analyzablePointerFieldAccess(e) or - analyzableImplicitThisFieldAccess(e) or - analyzableOtherVariable(e) or - analyzableConversion(e) or - analyzableBinaryOp(e) or - analyzableUnaryOp(e) or - analyzableThisExpr(e) or - analyzableArrayAccess(e) or - analyzablePointerDereferenceExpr(e) -} diff --git a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_gvn.expected b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_gvn.expected deleted file mode 100644 index 69c21b5e0b1d..000000000000 --- a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_gvn.expected +++ /dev/null @@ -1,41 +0,0 @@ -WARNING: Type GVN has been deprecated and may be removed in future (ast_gvn.ql:4,6-9) -| test.cpp:5:3:5:3 | x | 5:c3-c3 6:c3-c3 | -| test.cpp:5:7:5:8 | p0 | 5:c7-c8 6:c7-c8 | -| test.cpp:5:7:5:13 | ... + ... | 5:c7-c13 6:c7-c13 7:c7-c7 | -| test.cpp:5:12:5:13 | p1 | 5:c12-c13 6:c12-c13 | -| test.cpp:16:3:16:3 | x | 16:c3-c3 17:c3-c3 | -| test.cpp:16:7:16:8 | p0 | 16:c7-c8 17:c7-c8 | -| test.cpp:16:7:16:13 | ... + ... | 16:c7-c13 17:c7-c13 | -| test.cpp:16:7:16:24 | ... + ... | 16:c7-c24 17:c7-c24 18:c7-c7 | -| test.cpp:16:12:16:13 | p1 | 16:c12-c13 17:c12-c13 | -| test.cpp:16:17:16:24 | global01 | 16:c17-c24 17:c17-c24 | -| test.cpp:29:7:29:8 | p0 | 29:c7-c8 31:c7-c8 | -| test.cpp:29:7:29:13 | ... + ... | 29:c7-c13 31:c7-c13 | -| test.cpp:29:12:29:13 | p1 | 29:c12-c13 31:c12-c13 | -| test.cpp:31:7:31:24 | ... + ... | 31:c7-c24 32:c7-c7 | -| test.cpp:43:7:43:8 | p0 | 43:c7-c8 45:c7-c8 | -| test.cpp:43:7:43:13 | ... + ... | 43:c7-c13 45:c7-c13 | -| test.cpp:43:12:43:13 | p1 | 43:c12-c13 45:c12-c13 | -| test.cpp:44:9:44:9 | 0 | 44:c9-c9 51:c25-c25 53:c18-c21 56:c39-c42 59:c17-c20 88:c12-c12 | -| test.cpp:45:7:45:24 | ... + ... | 45:c7-c24 46:c7-c7 | -| test.cpp:53:10:53:13 | (int)... | 53:c10-c13 56:c21-c24 | -| test.cpp:53:10:53:13 | * ... | 53:c10-c13 56:c21-c24 | -| test.cpp:53:11:53:13 | str | 53:c11-c13 56:c22-c24 | -| test.cpp:53:18:53:21 | 0 | 53:c18-c21 56:c39-c42 59:c17-c20 | -| test.cpp:56:13:56:16 | (int)... | 56:c13-c16 56:c31-c34 59:c9-c12 | -| test.cpp:56:13:56:16 | * ... | 56:c13-c16 56:c31-c34 59:c9-c12 | -| test.cpp:56:14:56:16 | ptr | 56:c14-c16 56:c32-c34 56:c47-c49 59:c10-c12 | -| test.cpp:62:5:62:10 | result | 62:c5-c10 65:c10-c15 | -| test.cpp:77:20:77:30 | (signed short)... | 77:c20-c30 79:c7-c7 | -| test.cpp:79:11:79:14 | vals | 79:c11-c14 79:c24-c27 | -| test.cpp:105:11:105:12 | (Base *)... | 105:c11-c12 106:c14-c35 107:c11-c12 | -| test.cpp:105:11:105:12 | pd | 105:c11-c12 106:c33-c34 | -| test.cpp:105:15:105:15 | b | 105:c15-c15 107:c15-c15 109:c10-c10 | -| test.cpp:125:11:125:12 | pa | 125:c11-c12 126:c11-c12 128:c3-c4 129:c11-c12 | -| test.cpp:125:15:125:15 | x | 125:c15-c15 126:c15-c15 128:c7-c7 | -| test.cpp:136:11:136:18 | global_a | 136:c11-c18 137:c11-c18 139:c3-c10 | -| test.cpp:136:21:136:21 | x | 136:c21-c21 137:c21-c21 139:c13-c13 | -| test.cpp:144:11:144:12 | pa | 144:c11-c12 145:c11-c12 147:c3-c4 149:c11-c12 | -| test.cpp:145:15:145:15 | y | 145:c15-c15 147:c7-c7 | -| test.cpp:153:11:153:18 | global_a | 153:c11-c18 154:c11-c18 156:c3-c10 | -| test.cpp:153:21:153:21 | x | 153:c21-c21 154:c21-c21 | diff --git a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_gvn.ql b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_gvn.ql deleted file mode 100644 index 84d0a7b3672d..000000000000 --- a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_gvn.ql +++ /dev/null @@ -1,11 +0,0 @@ -import cpp -import semmle.code.cpp.valuenumbering.GlobalValueNumberingImpl - -from GVN g -where strictcount(g.getAnExpr()) > 1 -select g, - strictconcat(Location loc | - loc = g.getAnExpr().getLocation() - | - loc.getStartLine() + ":c" + loc.getStartColumn() + "-c" + loc.getEndColumn(), " " - ) diff --git a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_uniqueness.expected b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_uniqueness.expected deleted file mode 100644 index d94d58ad5eac..000000000000 --- a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_uniqueness.expected +++ /dev/null @@ -1,3 +0,0 @@ -WARNING: Predicate globalValueNumber has been deprecated and may be removed in future (ast_uniqueness.ql:7,13-30) -WARNING: Predicate globalValueNumber has been deprecated and may be removed in future (ast_uniqueness.ql:8,30-47) -WARNING: Type GVN has been deprecated and may be removed in future (ast_uniqueness.ql:8,18-21) diff --git a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_uniqueness.ql b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_uniqueness.ql deleted file mode 100644 index bc6dbf94bf7c..000000000000 --- a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_uniqueness.ql +++ /dev/null @@ -1,8 +0,0 @@ -import cpp -import semmle.code.cpp.valuenumbering.GlobalValueNumberingImpl - -// Every expression should have exactly one GVN. -// So this query should have zero results. -from Expr e -where count(globalValueNumber(e)) != 1 -select e, concat(GVN g | g = globalValueNumber(e) | g.getKind(), ", ") diff --git a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/diff_ir_expr.expected b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/diff_ir_expr.expected deleted file mode 100644 index 810c83f197f9..000000000000 --- a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/diff_ir_expr.expected +++ /dev/null @@ -1,130 +0,0 @@ -WARNING: Predicate globalValueNumber has been deprecated and may be removed in future (diff_ir_expr.ql:8,29-51) -| test.cpp:5:3:5:13 | ... = ... | test.cpp:5:3:5:13 | ... = ... | AST only | -| test.cpp:6:3:6:13 | ... = ... | test.cpp:6:3:6:13 | ... = ... | AST only | -| test.cpp:7:3:7:7 | ... = ... | test.cpp:7:3:7:7 | ... = ... | AST only | -| test.cpp:16:3:16:24 | ... = ... | test.cpp:16:3:16:24 | ... = ... | AST only | -| test.cpp:17:3:17:24 | ... = ... | test.cpp:17:3:17:24 | ... = ... | AST only | -| test.cpp:18:3:18:7 | ... = ... | test.cpp:18:3:18:7 | ... = ... | AST only | -| test.cpp:29:3:29:3 | x | test.cpp:31:3:31:3 | x | IR only | -| test.cpp:29:3:29:24 | ... = ... | test.cpp:29:3:29:24 | ... = ... | AST only | -| test.cpp:30:3:30:17 | call to change_global02 | test.cpp:30:3:30:17 | call to change_global02 | AST only | -| test.cpp:31:3:31:3 | x | test.cpp:29:3:29:3 | x | IR only | -| test.cpp:31:3:31:24 | ... = ... | test.cpp:31:3:31:24 | ... = ... | AST only | -| test.cpp:32:3:32:7 | ... = ... | test.cpp:32:3:32:7 | ... = ... | AST only | -| test.cpp:43:3:43:3 | x | test.cpp:45:3:45:3 | x | IR only | -| test.cpp:43:3:43:24 | ... = ... | test.cpp:43:3:43:24 | ... = ... | AST only | -| test.cpp:43:7:43:24 | ... + ... | test.cpp:45:7:45:24 | ... + ... | IR only | -| test.cpp:43:7:43:24 | ... + ... | test.cpp:46:7:46:7 | x | IR only | -| test.cpp:43:17:43:24 | global03 | test.cpp:45:17:45:24 | global03 | IR only | -| test.cpp:44:3:44:5 | * ... | test.cpp:44:4:44:5 | p2 | IR only | -| test.cpp:44:3:44:9 | ... = ... | test.cpp:44:3:44:9 | ... = ... | AST only | -| test.cpp:44:4:44:5 | p2 | test.cpp:44:3:44:5 | * ... | IR only | -| test.cpp:44:9:44:9 | 0 | test.cpp:51:25:51:25 | 0 | AST only | -| test.cpp:44:9:44:9 | 0 | test.cpp:53:18:53:21 | (int)... | AST only | -| test.cpp:44:9:44:9 | 0 | test.cpp:56:39:56:42 | (int)... | AST only | -| test.cpp:44:9:44:9 | 0 | test.cpp:59:17:59:20 | (int)... | AST only | -| test.cpp:44:9:44:9 | 0 | test.cpp:88:12:88:12 | 0 | AST only | -| test.cpp:45:3:45:3 | x | test.cpp:43:3:43:3 | x | IR only | -| test.cpp:45:3:45:24 | ... = ... | test.cpp:45:3:45:24 | ... = ... | AST only | -| test.cpp:45:7:45:24 | ... + ... | test.cpp:43:7:43:24 | ... + ... | IR only | -| test.cpp:45:17:45:24 | global03 | test.cpp:43:17:43:24 | global03 | IR only | -| test.cpp:46:3:46:7 | ... = ... | test.cpp:46:3:46:7 | ... = ... | AST only | -| test.cpp:46:7:46:7 | x | test.cpp:43:7:43:24 | ... + ... | IR only | -| test.cpp:51:25:51:25 | 0 | test.cpp:44:9:44:9 | 0 | AST only | -| test.cpp:51:25:51:25 | 0 | test.cpp:53:18:53:21 | (int)... | AST only | -| test.cpp:51:25:51:25 | 0 | test.cpp:56:39:56:42 | (int)... | AST only | -| test.cpp:51:25:51:25 | 0 | test.cpp:59:17:59:20 | (int)... | AST only | -| test.cpp:51:25:51:25 | 0 | test.cpp:88:12:88:12 | 0 | AST only | -| test.cpp:51:25:51:25 | (unsigned int)... | test.cpp:51:25:51:25 | (unsigned int)... | AST only | -| test.cpp:53:10:53:13 | (int)... | test.cpp:53:10:53:13 | (int)... | AST only | -| test.cpp:53:10:53:13 | (int)... | test.cpp:56:21:56:24 | (int)... | AST only | -| test.cpp:53:18:53:21 | (int)... | test.cpp:44:9:44:9 | 0 | AST only | -| test.cpp:53:18:53:21 | (int)... | test.cpp:51:25:51:25 | 0 | AST only | -| test.cpp:53:18:53:21 | (int)... | test.cpp:53:18:53:21 | (int)... | AST only | -| test.cpp:53:18:53:21 | (int)... | test.cpp:56:39:56:42 | (int)... | AST only | -| test.cpp:53:18:53:21 | (int)... | test.cpp:59:17:59:20 | (int)... | AST only | -| test.cpp:53:18:53:21 | (int)... | test.cpp:88:12:88:12 | 0 | AST only | -| test.cpp:55:5:55:15 | ... = ... | test.cpp:55:5:55:15 | ... = ... | AST only | -| test.cpp:56:12:56:25 | (...) | test.cpp:56:12:56:25 | (...) | AST only | -| test.cpp:56:12:56:43 | ... && ... | test.cpp:56:12:56:43 | ... && ... | AST only | -| test.cpp:56:13:56:16 | (int)... | test.cpp:56:13:56:16 | (int)... | AST only | -| test.cpp:56:13:56:16 | (int)... | test.cpp:56:31:56:34 | (int)... | AST only | -| test.cpp:56:13:56:16 | (int)... | test.cpp:59:9:59:12 | (int)... | AST only | -| test.cpp:56:21:56:24 | (int)... | test.cpp:53:10:53:13 | (int)... | AST only | -| test.cpp:56:21:56:24 | (int)... | test.cpp:56:21:56:24 | (int)... | AST only | -| test.cpp:56:30:56:43 | (...) | test.cpp:56:30:56:43 | (...) | AST only | -| test.cpp:56:31:56:34 | (int)... | test.cpp:56:13:56:16 | (int)... | AST only | -| test.cpp:56:31:56:34 | (int)... | test.cpp:56:31:56:34 | (int)... | AST only | -| test.cpp:56:31:56:34 | (int)... | test.cpp:59:9:59:12 | (int)... | AST only | -| test.cpp:56:39:56:42 | (int)... | test.cpp:44:9:44:9 | 0 | AST only | -| test.cpp:56:39:56:42 | (int)... | test.cpp:51:25:51:25 | 0 | AST only | -| test.cpp:56:39:56:42 | (int)... | test.cpp:53:18:53:21 | (int)... | AST only | -| test.cpp:56:39:56:42 | (int)... | test.cpp:56:39:56:42 | (int)... | AST only | -| test.cpp:56:39:56:42 | (int)... | test.cpp:59:17:59:20 | (int)... | AST only | -| test.cpp:56:39:56:42 | (int)... | test.cpp:88:12:88:12 | 0 | AST only | -| test.cpp:56:47:56:51 | ... ++ | test.cpp:56:47:56:51 | ... ++ | AST only | -| test.cpp:59:9:59:12 | (int)... | test.cpp:56:13:56:16 | (int)... | AST only | -| test.cpp:59:9:59:12 | (int)... | test.cpp:56:31:56:34 | (int)... | AST only | -| test.cpp:59:9:59:12 | (int)... | test.cpp:59:9:59:12 | (int)... | AST only | -| test.cpp:59:17:59:20 | (int)... | test.cpp:44:9:44:9 | 0 | AST only | -| test.cpp:59:17:59:20 | (int)... | test.cpp:51:25:51:25 | 0 | AST only | -| test.cpp:59:17:59:20 | (int)... | test.cpp:53:18:53:21 | (int)... | AST only | -| test.cpp:59:17:59:20 | (int)... | test.cpp:56:39:56:42 | (int)... | AST only | -| test.cpp:59:17:59:20 | (int)... | test.cpp:59:17:59:20 | (int)... | AST only | -| test.cpp:59:17:59:20 | (int)... | test.cpp:88:12:88:12 | 0 | AST only | -| test.cpp:62:5:62:12 | ... ++ | test.cpp:62:5:62:12 | ... ++ | AST only | -| test.cpp:77:20:77:28 | call to getAValue | test.cpp:79:7:79:7 | v | IR only | -| test.cpp:77:20:77:30 | (signed short)... | test.cpp:77:20:77:30 | (signed short)... | AST only | -| test.cpp:77:20:77:30 | (signed short)... | test.cpp:79:7:79:7 | v | AST only | -| test.cpp:79:7:79:7 | (int)... | test.cpp:79:7:79:7 | (int)... | AST only | -| test.cpp:79:7:79:7 | v | test.cpp:77:20:77:28 | call to getAValue | IR only | -| test.cpp:79:7:79:7 | v | test.cpp:77:20:77:30 | (signed short)... | AST only | -| test.cpp:79:11:79:20 | (int)... | test.cpp:79:11:79:20 | (int)... | AST only | -| test.cpp:79:24:79:33 | (int)... | test.cpp:79:24:79:33 | (int)... | AST only | -| test.cpp:80:5:80:19 | ... = ... | test.cpp:80:5:80:19 | ... = ... | AST only | -| test.cpp:80:9:80:19 | (signed short)... | test.cpp:80:9:80:19 | (signed short)... | AST only | -| test.cpp:88:3:88:20 | ... = ... | test.cpp:88:3:88:20 | ... = ... | AST only | -| test.cpp:88:12:88:12 | 0 | test.cpp:44:9:44:9 | 0 | AST only | -| test.cpp:88:12:88:12 | 0 | test.cpp:51:25:51:25 | 0 | AST only | -| test.cpp:88:12:88:12 | 0 | test.cpp:53:18:53:21 | (int)... | AST only | -| test.cpp:88:12:88:12 | 0 | test.cpp:56:39:56:42 | (int)... | AST only | -| test.cpp:88:12:88:12 | 0 | test.cpp:59:17:59:20 | (int)... | AST only | -| test.cpp:88:12:88:12 | (void *)... | test.cpp:88:12:88:12 | (void *)... | AST only | -| test.cpp:92:11:92:16 | ... = ... | test.cpp:92:15:92:16 | 10 | IR only | -| test.cpp:92:11:92:16 | ... = ... | test.cpp:93:10:93:10 | x | IR only | -| test.cpp:92:15:92:16 | 10 | test.cpp:92:11:92:16 | ... = ... | IR only | -| test.cpp:92:15:92:16 | 10 | test.cpp:93:10:93:10 | x | IR only | -| test.cpp:93:10:93:10 | x | test.cpp:92:11:92:16 | ... = ... | IR only | -| test.cpp:93:10:93:10 | x | test.cpp:92:15:92:16 | 10 | IR only | -| test.cpp:105:11:105:12 | (Base *)... | test.cpp:105:11:105:12 | (Base *)... | AST only | -| test.cpp:105:11:105:12 | (Base *)... | test.cpp:106:14:106:35 | static_cast... | AST only | -| test.cpp:105:11:105:12 | (Base *)... | test.cpp:107:11:107:12 | pb | AST only | -| test.cpp:105:11:105:12 | pd | test.cpp:107:11:107:12 | pb | IR only | -| test.cpp:106:14:106:35 | static_cast... | test.cpp:105:11:105:12 | (Base *)... | AST only | -| test.cpp:106:14:106:35 | static_cast... | test.cpp:106:14:106:35 | static_cast... | AST only | -| test.cpp:106:14:106:35 | static_cast... | test.cpp:107:11:107:12 | pb | AST only | -| test.cpp:106:33:106:34 | pd | test.cpp:107:11:107:12 | pb | IR only | -| test.cpp:107:11:107:12 | pb | test.cpp:105:11:105:12 | (Base *)... | AST only | -| test.cpp:107:11:107:12 | pb | test.cpp:105:11:105:12 | pd | IR only | -| test.cpp:107:11:107:12 | pb | test.cpp:106:14:106:35 | static_cast... | AST only | -| test.cpp:107:11:107:12 | pb | test.cpp:106:33:106:34 | pd | IR only | -| test.cpp:113:3:113:5 | a | test.cpp:115:3:115:5 | a | IR only | -| test.cpp:115:3:115:5 | a | test.cpp:113:3:113:5 | a | IR only | -| test.cpp:125:15:125:15 | x | test.cpp:128:7:128:7 | x | AST only | -| test.cpp:126:15:126:15 | x | test.cpp:128:7:128:7 | x | AST only | -| test.cpp:128:3:128:11 | ... = ... | test.cpp:128:3:128:11 | ... = ... | AST only | -| test.cpp:128:7:128:7 | x | test.cpp:125:15:125:15 | x | AST only | -| test.cpp:128:7:128:7 | x | test.cpp:126:15:126:15 | x | AST only | -| test.cpp:128:11:128:11 | n | test.cpp:129:15:129:15 | x | IR only | -| test.cpp:129:15:129:15 | x | test.cpp:128:11:128:11 | n | IR only | -| test.cpp:136:21:136:21 | x | test.cpp:139:13:139:13 | x | AST only | -| test.cpp:137:21:137:21 | x | test.cpp:139:13:139:13 | x | AST only | -| test.cpp:139:3:139:24 | ... = ... | test.cpp:139:3:139:24 | ... = ... | AST only | -| test.cpp:139:13:139:13 | x | test.cpp:136:21:136:21 | x | AST only | -| test.cpp:139:13:139:13 | x | test.cpp:137:21:137:21 | x | AST only | -| test.cpp:144:15:144:15 | x | test.cpp:149:15:149:15 | x | IR only | -| test.cpp:145:15:145:15 | y | test.cpp:147:7:147:7 | y | AST only | -| test.cpp:147:3:147:18 | ... = ... | test.cpp:147:3:147:18 | ... = ... | AST only | -| test.cpp:147:7:147:7 | y | test.cpp:145:15:145:15 | y | AST only | -| test.cpp:149:15:149:15 | x | test.cpp:144:15:144:15 | x | IR only | -| test.cpp:156:3:156:17 | ... = ... | test.cpp:156:3:156:17 | ... = ... | AST only | diff --git a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/diff_ir_expr.ql b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/diff_ir_expr.ql deleted file mode 100644 index 7b897f39dbd9..000000000000 --- a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/diff_ir_expr.ql +++ /dev/null @@ -1,15 +0,0 @@ -import cpp -import semmle.code.cpp.valuenumbering.GlobalValueNumberingImpl as AST -import semmle.code.cpp.ir.internal.ASTValueNumbering as IR -import semmle.code.cpp.ir.IR - -Expr ir(Expr e) { result = IR::globalValueNumber(e).getAnExpr() } - -Expr ast(Expr e) { result = AST::globalValueNumber(e).getAnExpr() } - -from Expr e, Expr evn, string note -where - evn = ast(e) and not evn = ir(e) and note = "AST only" - or - evn = ir(e) and not evn = ast(e) and note = "IR only" -select e, evn, note diff --git a/csharp/ql/lib/change-notes/2024-04-26-outdated-deprecations.md b/csharp/ql/lib/change-notes/2024-04-26-outdated-deprecations.md new file mode 100644 index 000000000000..314bb6e01fe3 --- /dev/null +++ b/csharp/ql/lib/change-notes/2024-04-26-outdated-deprecations.md @@ -0,0 +1,6 @@ +--- +category: breaking +--- +* Deleted the deprecated `getAssemblyName` predicate from the `Operator` class. Use `getFunctionName` instead. +* Deleted the deprecated `LShiftOperator`, `RShiftOperator`, `AssignLShiftExpr`, `AssignRShiftExpr`, `LShiftExpr`, and `RShiftExpr` aliases. +* Deleted the deprecated `getCallableDescription` predicate from the `ExternalApiDataNode` class. Use `hasQualifiedName` instead. \ No newline at end of file diff --git a/csharp/ql/lib/semmle/code/csharp/Callable.qll b/csharp/ql/lib/semmle/code/csharp/Callable.qll index 9cd365c2ecd6..59cffa8d39e5 100644 --- a/csharp/ql/lib/semmle/code/csharp/Callable.qll +++ b/csharp/ql/lib/semmle/code/csharp/Callable.qll @@ -527,13 +527,6 @@ class Destructor extends Callable, Member, Attributable, @destructor { * (`BinaryOperator`), or a conversion operator (`ConversionOperator`). */ class Operator extends Callable, Member, Attributable, Overridable, @operator { - /** - * DEPRECATED: use `getFunctionName()` instead. - * - * Gets the assembly name of this operator. - */ - deprecated string getAssemblyName() { result = this.getFunctionName() } - override string getName() { operators(this, _, result, _, _, _) } override string getUndecoratedName() { operators(this, _, result, _, _, _) } @@ -989,9 +982,6 @@ class LeftShiftOperator extends BinaryOperator { override string getAPrimaryQlClass() { result = "LeftShiftOperator" } } -/** DEPRECATED: Alias for LeftShiftOperator. */ -deprecated class LShiftOperator = LeftShiftOperator; - /** * A user-defined right shift operator (`>>`), for example * @@ -1007,9 +997,6 @@ class RightShiftOperator extends BinaryOperator { override string getAPrimaryQlClass() { result = "RightShiftOperator" } } -/** DEPRECATED: Alias for RightShiftOperator. */ -deprecated class RShiftOperator = RightShiftOperator; - /** * A user-defined unsigned right shift operator (`>>>`), for example * diff --git a/csharp/ql/lib/semmle/code/csharp/exprs/Assignment.qll b/csharp/ql/lib/semmle/code/csharp/exprs/Assignment.qll index 14da6da266f7..a5576f023d7b 100644 --- a/csharp/ql/lib/semmle/code/csharp/exprs/Assignment.qll +++ b/csharp/ql/lib/semmle/code/csharp/exprs/Assignment.qll @@ -192,9 +192,6 @@ class AssignLeftShiftExpr extends AssignBitwiseOperation, @assign_lshift_expr { override string getAPrimaryQlClass() { result = "AssignLeftShiftExpr" } } -/** DEPRECATED: Alias for AssignLeftShipExpr. */ -deprecated class AssignLShiftExpr = AssignLeftShiftExpr; - /** * A right-shift assignment operation, for example `x >>= y`. */ @@ -204,9 +201,6 @@ class AssignRightShiftExpr extends AssignBitwiseOperation, @assign_rshift_expr { override string getAPrimaryQlClass() { result = "AssignRightShiftExpr" } } -/** DEPRECATED: Alias for AssignRightShiftExpr. */ -deprecated class AssignRShiftExpr = AssignRightShiftExpr; - /** * An unsigned right-shift assignment operation, for example `x >>>= y`. */ diff --git a/csharp/ql/lib/semmle/code/csharp/exprs/BitwiseOperation.qll b/csharp/ql/lib/semmle/code/csharp/exprs/BitwiseOperation.qll index d32485a51f8e..d818a1d08f87 100644 --- a/csharp/ql/lib/semmle/code/csharp/exprs/BitwiseOperation.qll +++ b/csharp/ql/lib/semmle/code/csharp/exprs/BitwiseOperation.qll @@ -47,9 +47,6 @@ class LeftShiftExpr extends BinaryBitwiseOperation, @lshift_expr { override string getAPrimaryQlClass() { result = "LeftShiftExpr" } } -/** DEPRECATED: Alias for LeftShiftExpr. */ -deprecated class LShiftExpr = LeftShiftExpr; - /** * A right-shift operation, for example `x >> y`. */ @@ -59,9 +56,6 @@ class RightShiftExpr extends BinaryBitwiseOperation, @rshift_expr { override string getAPrimaryQlClass() { result = "RightShiftExpr" } } -/** DEPRECATED: Alias for RightShiftExpr. */ -deprecated class RShiftExpr = RightShiftExpr; - /** * An unsigned right-shift operation, for example `x >>> y`. */ diff --git a/csharp/ql/lib/semmle/code/csharp/security/dataflow/ExternalAPIsQuery.qll b/csharp/ql/lib/semmle/code/csharp/security/dataflow/ExternalAPIsQuery.qll index a0d0ada957a5..41888fc25571 100644 --- a/csharp/ql/lib/semmle/code/csharp/security/dataflow/ExternalAPIsQuery.qll +++ b/csharp/ql/lib/semmle/code/csharp/security/dataflow/ExternalAPIsQuery.qll @@ -71,17 +71,6 @@ class ExternalApiDataNode extends DataFlow::Node { predicate hasQualifiedName(string qualifier, string name) { this.getCallable().hasFullyQualifiedName(qualifier, name) } - - /** - * DEPRECATED: Use hasQualifiedName/2 instead. - * - * Gets the description of the callable being called. - */ - deprecated string getCallableDescription() { - exists(string qualifier, string name | - this.hasQualifiedName(qualifier, name) and result = getQualifiedName(qualifier, name) - ) - } } /** diff --git a/go/ql/lib/change-notes/2024-04-26-outdated-deprecations.md b/go/ql/lib/change-notes/2024-04-26-outdated-deprecations.md new file mode 100644 index 000000000000..2c7b522b792c --- /dev/null +++ b/go/ql/lib/change-notes/2024-04-26-outdated-deprecations.md @@ -0,0 +1,4 @@ +--- +category: breaking +--- +* Deleted the deprecated `CsvRemoteSource` alias. Use `MaDRemoteSource` instead. \ No newline at end of file diff --git a/go/ql/lib/semmle/go/security/FlowSources.qll b/go/ql/lib/semmle/go/security/FlowSources.qll index 6de620c79e42..cf77dade35ab 100644 --- a/go/ql/lib/semmle/go/security/FlowSources.qll +++ b/go/ql/lib/semmle/go/security/FlowSources.qll @@ -39,6 +39,4 @@ module RemoteFlowSource { class MaDRemoteSource extends Range { MaDRemoteSource() { ExternalFlow::sourceNode(this, "remote") } } - - deprecated class CsvRemoteSource = MaDRemoteSource; } diff --git a/java/ql/lib/change-notes/2024-04-26-outdated-deprecations.md b/java/ql/lib/change-notes/2024-04-26-outdated-deprecations.md new file mode 100644 index 000000000000..fb245f821a82 --- /dev/null +++ b/java/ql/lib/change-notes/2024-04-26-outdated-deprecations.md @@ -0,0 +1,4 @@ +--- +category: breaking +--- +* Deleted the deprecated `AssignLShiftExpr`, `AssignRShiftExpr`, `AssignURShiftExpr`, `LShiftExpr`, `RShiftExpr`, and `URShiftExpr` aliases. diff --git a/java/ql/lib/semmle/code/java/Expr.qll b/java/ql/lib/semmle/code/java/Expr.qll index e0208b4df9e4..1862319e30bb 100644 --- a/java/ql/lib/semmle/code/java/Expr.qll +++ b/java/ql/lib/semmle/code/java/Expr.qll @@ -511,9 +511,6 @@ class AssignLeftShiftExpr extends AssignOp, @assignlshiftexpr { override string getAPrimaryQlClass() { result = "AssignLeftShiftExpr" } } -/** DEPRECATED: Alias for AssignLeftShiftExpr. */ -deprecated class AssignLShiftExpr = AssignLeftShiftExpr; - /** A compound assignment expression using the `>>=` operator. */ class AssignRightShiftExpr extends AssignOp, @assignrshiftexpr { override string getOp() { result = ">>=" } @@ -521,9 +518,6 @@ class AssignRightShiftExpr extends AssignOp, @assignrshiftexpr { override string getAPrimaryQlClass() { result = "AssignRightShiftExpr" } } -/** DEPRECATED: Alias for AssignRightShiftExpr. */ -deprecated class AssignRShiftExpr = AssignRightShiftExpr; - /** A compound assignment expression using the `>>>=` operator. */ class AssignUnsignedRightShiftExpr extends AssignOp, @assignurshiftexpr { override string getOp() { result = ">>>=" } @@ -531,9 +525,6 @@ class AssignUnsignedRightShiftExpr extends AssignOp, @assignurshiftexpr { override string getAPrimaryQlClass() { result = "AssignUnsignedRightShiftExpr" } } -/** DEPRECATED: Alias for AssignUnsignedRightShiftExpr. */ -deprecated class AssignURShiftExpr = AssignUnsignedRightShiftExpr; - /** A common super-class to represent constant literals. */ class Literal extends Expr, @literal { /** @@ -793,9 +784,6 @@ class LeftShiftExpr extends BinaryExpr, @lshiftexpr { override string getAPrimaryQlClass() { result = "LeftShiftExpr" } } -/** DEPRECATED: Alias for LeftShiftExpr. */ -deprecated class LShiftExpr = LeftShiftExpr; - /** A binary expression using the `>>` operator. */ class RightShiftExpr extends BinaryExpr, @rshiftexpr { override string getOp() { result = " >> " } @@ -803,9 +791,6 @@ class RightShiftExpr extends BinaryExpr, @rshiftexpr { override string getAPrimaryQlClass() { result = "RightShiftExpr" } } -/** DEPRECATED: Alias for RightShiftExpr. */ -deprecated class RShiftExpr = RightShiftExpr; - /** A binary expression using the `>>>` operator. */ class UnsignedRightShiftExpr extends BinaryExpr, @urshiftexpr { override string getOp() { result = " >>> " } @@ -813,9 +798,6 @@ class UnsignedRightShiftExpr extends BinaryExpr, @urshiftexpr { override string getAPrimaryQlClass() { result = "UnsignedRightShiftExpr" } } -/** DEPRECATED: Alias for UnsignedRightShiftExpr. */ -deprecated class URShiftExpr = UnsignedRightShiftExpr; - /** A binary expression using the `&` operator. */ class AndBitwiseExpr extends BinaryExpr, @andbitexpr { override string getOp() { result = " & " } diff --git a/java/ql/lib/semmle/code/java/regex/RegexTreeView.qll b/java/ql/lib/semmle/code/java/regex/RegexTreeView.qll index 7575ccb62135..a07d7c741faa 100644 --- a/java/ql/lib/semmle/code/java/regex/RegexTreeView.qll +++ b/java/ql/lib/semmle/code/java/regex/RegexTreeView.qll @@ -1162,14 +1162,6 @@ module Impl implements RegexTreeViewSig { root.getLiteral().isIgnoreCase() } - /** - * Gets the flags for `root`, or the empty string if `root` has no flags. - */ - additional deprecated string getFlags(RegExpTerm root) { - root.isRootTerm() and - result = root.getLiteral().getFlags() - } - /** * Holds if `root` has the `s` flag for multi-line matching. */ diff --git a/javascript/ql/lib/change-notes/2024-04-26-outdated-deprecations.md b/javascript/ql/lib/change-notes/2024-04-26-outdated-deprecations.md new file mode 100644 index 000000000000..59a90e91ec86 --- /dev/null +++ b/javascript/ql/lib/change-notes/2024-04-26-outdated-deprecations.md @@ -0,0 +1,6 @@ +--- +category: breaking +--- +* Deleted the deprecated `getInput` predicate from the `CryptographicOperation` class. Use `getAnInput` instead. +* Deleted the deprecated `RegExpPatterns` module from `Regexp.qll`. +* Deleted the deprecated `semmle/javascript/security/BadTagFilterQuery.qll`, `semmle/javascript/security/OverlyLargeRangeQuery.qll`, `semmle/javascript/security/regexp/RegexpMatching.qll`, and `Security/CWE-020/HostnameRegexpShared.qll` files. \ No newline at end of file diff --git a/javascript/ql/lib/semmle/javascript/Concepts.qll b/javascript/ql/lib/semmle/javascript/Concepts.qll index 01970490374c..14102556a874 100644 --- a/javascript/ql/lib/semmle/javascript/Concepts.qll +++ b/javascript/ql/lib/semmle/javascript/Concepts.qll @@ -125,16 +125,7 @@ module Cryptography { * extend `CryptographicOperation::Range` instead. */ class CryptographicOperation extends SC::CryptographicOperation instanceof CryptographicOperation::Range - { - /** - * DEPRECATED. This predicate has been renamed to `getAnInput`. - * - * To implement `CryptographicOperation`, please extend - * `CryptographicOperation::Range` and implement `getAnInput` instead of - * extending this class directly. - */ - deprecated final DataFlow::Node getInput() { result = this.getAnInput() } - } + { } class EncryptionAlgorithm = SC::EncryptionAlgorithm; diff --git a/javascript/ql/lib/semmle/javascript/Regexp.qll b/javascript/ql/lib/semmle/javascript/Regexp.qll index 3c190af44764..27ad339c733e 100644 --- a/javascript/ql/lib/semmle/javascript/Regexp.qll +++ b/javascript/ql/lib/semmle/javascript/Regexp.qll @@ -1022,20 +1022,6 @@ predicate isInterpretedAsRegExp(DataFlow::Node source) { ) } -/** - * Provides utility predicates related to regular expressions. - */ -deprecated module RegExpPatterns { - /** - * Gets a pattern that matches common top-level domain names in lower case. - * DEPRECATED: use the similarly named predicate from `HostnameRegex` from the `regex` pack instead. - */ - deprecated string getACommonTld() { - // according to ranking by http://google.com/search?q=site:.<> - result = "(?:com|org|edu|gov|uk|net|io)(?![a-z0-9])" - } -} - /** * Gets a node whose value may flow (inter-procedurally) to `re`, where it is interpreted * as a part of a regular expression. diff --git a/javascript/ql/lib/semmle/javascript/security/BadTagFilterQuery.qll b/javascript/ql/lib/semmle/javascript/security/BadTagFilterQuery.qll deleted file mode 100644 index 0bc83143e8ca..000000000000 --- a/javascript/ql/lib/semmle/javascript/security/BadTagFilterQuery.qll +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Provides predicates for reasoning about bad tag filter vulnerabilities. - */ - -private import regexp.RegExpTreeView::RegExpTreeView as TreeView -// BadTagFilterQuery should be used directly from the shared pack, and not from this file. -deprecated private import codeql.regex.nfa.BadTagFilterQuery::Make as Dep -import Dep diff --git a/javascript/ql/lib/semmle/javascript/security/OverlyLargeRangeQuery.qll b/javascript/ql/lib/semmle/javascript/security/OverlyLargeRangeQuery.qll deleted file mode 100644 index 2053afe95f8c..000000000000 --- a/javascript/ql/lib/semmle/javascript/security/OverlyLargeRangeQuery.qll +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Classes and predicates for working with suspicious character ranges. - */ - -private import regexp.RegExpTreeView::RegExpTreeView as TreeView -// OverlyLargeRangeQuery should be used directly from the shared pack, and not from this file. -deprecated private import codeql.regex.OverlyLargeRangeQuery::Make as Dep -import Dep diff --git a/javascript/ql/lib/semmle/javascript/security/regexp/RegexpMatching.qll b/javascript/ql/lib/semmle/javascript/security/regexp/RegexpMatching.qll deleted file mode 100644 index cfc0f4992406..000000000000 --- a/javascript/ql/lib/semmle/javascript/security/regexp/RegexpMatching.qll +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Provides predicates for reasoning about which strings are matched by a regular expression, - * and for testing which capture groups are filled when a particular regexp matches a string. - */ - -private import RegExpTreeView::RegExpTreeView as TreeView -// RegexpMatching should be used directly from the shared pack, and not from this file. -deprecated private import codeql.regex.nfa.RegexpMatching::Make as Dep -import Dep diff --git a/javascript/ql/src/Security/CWE-020/HostnameRegexpShared.qll b/javascript/ql/src/Security/CWE-020/HostnameRegexpShared.qll deleted file mode 100644 index 524be45c6539..000000000000 --- a/javascript/ql/src/Security/CWE-020/HostnameRegexpShared.qll +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Provides predicates for reasoning about regular expressions - * that match URLs and hostname patterns. - */ - -deprecated import semmle.javascript.security.regexp.HostnameRegexp as Dep -import Dep diff --git a/python/ql/lib/change-notes/2024-04-26-outdated-deprecations.md b/python/ql/lib/change-notes/2024-04-26-outdated-deprecations.md new file mode 100644 index 000000000000..db64f0a98312 --- /dev/null +++ b/python/ql/lib/change-notes/2024-04-26-outdated-deprecations.md @@ -0,0 +1,5 @@ +--- +category: breaking +--- +* Deleted the deprecated `RegExpPatterns` module from `Regexp.qll`. +* Deleted the deprecated `Security/CWE-020/HostnameRegexpShared.qll` file. \ No newline at end of file diff --git a/python/ql/lib/semmle/python/dataflow/new/Regexp.qll b/python/ql/lib/semmle/python/dataflow/new/Regexp.qll index e1f824b2935c..1f13b3847d7b 100644 --- a/python/ql/lib/semmle/python/dataflow/new/Regexp.qll +++ b/python/ql/lib/semmle/python/dataflow/new/Regexp.qll @@ -7,20 +7,6 @@ private import semmle.python.regex private import semmle.python.dataflow.new.DataFlow private import semmle.python.regexp.internal.RegExpTracking -/** - * Provides utility predicates related to regular expressions. - */ -deprecated module RegExpPatterns { - /** - * Gets a pattern that matches common top-level domain names in lower case. - * DEPRECATED: use the similarly named predicate from `HostnameRegex` from the `regex` pack instead. - */ - deprecated string getACommonTld() { - // according to ranking by http://google.com/search?q=site:.<> - result = "(?:com|org|edu|gov|uk|net|io)(?![a-z0-9])" - } -} - /** * A node whose value may flow to a position where it is interpreted * as a part of a regular expression. diff --git a/python/ql/src/Security/CWE-020/HostnameRegexpShared.qll b/python/ql/src/Security/CWE-020/HostnameRegexpShared.qll deleted file mode 100644 index d15714d406aa..000000000000 --- a/python/ql/src/Security/CWE-020/HostnameRegexpShared.qll +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Provides predicates for reasoning about regular expressions - * that match URLs and hostname patterns. - */ - -// HostnameRegexp should be used directly from the shared regex pack, and not from this file. -deprecated private import semmle.python.security.regexp.HostnameRegex as Dep -import Dep diff --git a/ruby/ql/lib/change-notes/2024-04-26-outdated-deprecations.md b/ruby/ql/lib/change-notes/2024-04-26-outdated-deprecations.md new file mode 100644 index 000000000000..76cc93df2aaa --- /dev/null +++ b/ruby/ql/lib/change-notes/2024-04-26-outdated-deprecations.md @@ -0,0 +1,5 @@ +--- +category: breaking +--- +* Deleted the deprecated `RegExpPatterns` module from `Regexp.qll`. +* Deleted the deprecated `security/cwe-020/HostnameRegexpShared.qll` file. \ No newline at end of file diff --git a/ruby/ql/lib/codeql/ruby/Regexp.qll b/ruby/ql/lib/codeql/ruby/Regexp.qll index 6ca1d40dc632..124666c95a03 100644 --- a/ruby/ql/lib/codeql/ruby/Regexp.qll +++ b/ruby/ql/lib/codeql/ruby/Regexp.qll @@ -14,20 +14,6 @@ private import codeql.ruby.DataFlow private import codeql.ruby.ApiGraphs private import codeql.ruby.Concepts -/** - * Provides utility predicates related to regular expressions. - */ -deprecated module RegExpPatterns { - /** - * Gets a pattern that matches common top-level domain names in lower case. - * DEPRECATED: use the similarly named predicate from `HostnameRegex` from the `regex` pack instead. - */ - deprecated string getACommonTld() { - // according to ranking by http://google.com/search?q=site:.<> - result = "(?:com|org|edu|gov|uk|net|io)(?![a-z0-9])" - } -} - /** * A node whose value may flow to a position where it is interpreted * as a part of a regular expression. diff --git a/ruby/ql/src/queries/security/cwe-020/HostnameRegexpShared.qll b/ruby/ql/src/queries/security/cwe-020/HostnameRegexpShared.qll deleted file mode 100644 index dc3ed9aeaf77..000000000000 --- a/ruby/ql/src/queries/security/cwe-020/HostnameRegexpShared.qll +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Provides predicates for reasoning about regular expressions - * that match URLs and hostname patterns. - */ - -// HostnameRegexp should be used directly from the shared regex pack, and not from this file. -deprecated import codeql.ruby.security.regexp.HostnameRegexp as Dep -import Dep