diff --git a/cpp/ql/lib/DefaultOptions.qll b/cpp/ql/lib/DefaultOptions.qll index e4aa8d1f2d74..e6631f1307af 100644 --- a/cpp/ql/lib/DefaultOptions.qll +++ b/cpp/ql/lib/DefaultOptions.qll @@ -30,8 +30,6 @@ class Options extends string { predicate overrideReturnsNull(Call call) { // Used in CVS: call.(FunctionCall).getTarget().hasGlobalName("Xstrdup") - or - CustomOptions::overrideReturnsNull(call) // old Options.qll } /** @@ -45,8 +43,6 @@ class Options extends string { // Used in CVS: call.(FunctionCall).getTarget().hasGlobalName("Xstrdup") and nullValue(call.getArgument(0)) - or - CustomOptions::returnsNull(call) // old Options.qll } /** @@ -65,8 +61,6 @@ class Options extends string { f.hasGlobalOrStdName([ "exit", "_exit", "_Exit", "abort", "__assert_fail", "longjmp", "__builtin_unreachable" ]) - or - CustomOptions::exits(f) // old Options.qll } /** @@ -79,8 +73,7 @@ class Options extends string { * runtime, the program's behavior is undefined) */ predicate exprExits(Expr e) { - e.(AssumeExpr).getChild(0).(CompileTimeConstantInt).getIntValue() = 0 or - CustomOptions::exprExits(e) // old Options.qll + e.(AssumeExpr).getChild(0).(CompileTimeConstantInt).getIntValue() = 0 } /** @@ -88,10 +81,7 @@ class Options extends string { * * By default holds only for `fgets`. */ - predicate alwaysCheckReturnValue(Function f) { - f.hasGlobalOrStdName("fgets") or - CustomOptions::alwaysCheckReturnValue(f) // old Options.qll - } + predicate alwaysCheckReturnValue(Function f) { f.hasGlobalOrStdName("fgets") } /** * Holds if it is reasonable to ignore the return value of function @@ -107,8 +97,6 @@ class Options extends string { // common way of sleeping using select: fc.getTarget().hasGlobalName("select") and fc.getArgument(0).getValue() = "0" - or - CustomOptions::okToIgnoreReturnValue(fc) // old Options.qll } } diff --git a/cpp/ql/lib/Options.qll b/cpp/ql/lib/Options.qll index c4652e3f6cae..fb2f24119db3 100644 --- a/cpp/ql/lib/Options.qll +++ b/cpp/ql/lib/Options.qll @@ -98,57 +98,3 @@ class CustomMutexType extends MutexType { */ override predicate unlockAccess(FunctionCall fc, Expr arg) { none() } } - -/** - * DEPRECATED: customize `CustomOptions.overrideReturnsNull` instead. - * - * This predicate is required to support backwards compatibility for - * older `Options.qll` files. It should not be removed or modified by - * end users. - */ -predicate overrideReturnsNull(Call call) { none() } - -/** - * DEPRECATED: customize `CustomOptions.returnsNull` instead. - * - * This predicate is required to support backwards compatibility for - * older `Options.qll` files. It should not be removed or modified by - * end users. - */ -predicate returnsNull(Call call) { none() } - -/** - * DEPRECATED: customize `CustomOptions.exits` instead. - * - * This predicate is required to support backwards compatibility for - * older `Options.qll` files. It should not be removed or modified by - * end users. - */ -predicate exits(Function f) { none() } - -/** - * DEPRECATED: customize `CustomOptions.exprExits` instead. - * - * This predicate is required to support backwards compatibility for - * older `Options.qll` files. It should not be removed or modified by - * end users. - */ -predicate exprExits(Expr e) { none() } - -/** - * DEPRECATED: customize `CustomOptions.alwaysCheckReturnValue` instead. - * - * This predicate is required to support backwards compatibility for - * older `Options.qll` files. It should not be removed or modified by - * end users. - */ -predicate alwaysCheckReturnValue(Function f) { none() } - -/** - * DEPRECATED: customize `CustomOptions.okToIgnoreReturnValue` instead. - * - * This predicate is required to support backwards compatibility for - * older `Options.qll` files. It should not be removed or modified by - * end users. - */ -predicate okToIgnoreReturnValue(FunctionCall fc) { none() } diff --git a/cpp/ql/lib/change-notes/2026-05-27-deprecated-removal.md b/cpp/ql/lib/change-notes/2026-05-27-deprecated-removal.md new file mode 100644 index 000000000000..33ad83230d44 --- /dev/null +++ b/cpp/ql/lib/change-notes/2026-05-27-deprecated-removal.md @@ -0,0 +1,15 @@ +--- +category: breaking +--- +* Removed the deprecated `overrideReturnsNull` predicate from `Options.qll`. Use `CustomOptions.overrideReturnsNull` instead. +* Removed the deprecated `returnsNull` predicate from `Options.qll`. Use `CustomOptions.returnsNull` instead. +* Removed the deprecated `exits` predicate from `Options.qll`. Use `CustomOptions.exits` instead. +* Removed the deprecated `exprExits` predicate from `Options.qll`. Use `CustomOptions.exprExits` instead. +* Removed the deprecated `alwaysCheckReturnValue` predicate from `Options.qll`. Use `CustomOptions.alwaysCheckReturnValue` instead. +* Removed the deprecated `okToIgnoreReturnValue` predicate from `Options.qll`. Use `CustomOptions.okToIgnoreReturnValue` instead. +* Removed the deprecated `semmle.code.cpp.Member`. Import `semmle.code.cpp.Element` and/or `semmle.code.cpp.Type` directly. +* Removed the deprecated `UnknownDefaultLocation` class. Use `UnknownLocation` instead. +* Removed the deprecated `UnknownExprLocation` class. Use `UnknownLocation` instead. +* Removed the deprecated `UnknownStmtLocation` class. Use `UnknownLocation` instead. +* Removed the deprecated `TemplateParameter` class. Use `TypeTemplateParameter` instead. +* Support for class resolution across link targets has been removed for databases which were created with CodeQL versions before 1.23.0. diff --git a/cpp/ql/lib/cpp.qll b/cpp/ql/lib/cpp.qll index 560a4444bfad..9cc9f7eb1ef6 100644 --- a/cpp/ql/lib/cpp.qll +++ b/cpp/ql/lib/cpp.qll @@ -32,7 +32,6 @@ import semmle.code.cpp.Class import semmle.code.cpp.Struct import semmle.code.cpp.Union import semmle.code.cpp.Enum -import semmle.code.cpp.Member import semmle.code.cpp.Field import semmle.code.cpp.Function import semmle.code.cpp.MemberFunction diff --git a/cpp/ql/lib/semmle/code/cpp/Location.qll b/cpp/ql/lib/semmle/code/cpp/Location.qll index 8b0a78f91aa8..92668206a9f1 100644 --- a/cpp/ql/lib/semmle/code/cpp/Location.qll +++ b/cpp/ql/lib/semmle/code/cpp/Location.qll @@ -148,28 +148,3 @@ class UnknownLocation extends Location { this.getFile().getAbsolutePath() = "" and locations_default(this, _, 0, 0, 0, 0) } } - -/** - * A dummy location which is used when something doesn't have a location in - * the source code but needs to have a `Location` associated with it. - * - * DEPRECATED: use `UnknownLocation` - */ -deprecated class UnknownDefaultLocation extends UnknownLocation { } - -/** - * A dummy location which is used when an expression doesn't have a - * location in the source code but needs to have a `Location` associated - * with it. - * - * DEPRECATED: use `UnknownLocation` - */ -deprecated class UnknownExprLocation extends UnknownLocation { } - -/** - * A dummy location which is used when a statement doesn't have a location - * in the source code but needs to have a `Location` associated with it. - * - * DEPRECATED: use `UnknownLocation` - */ -deprecated class UnknownStmtLocation extends UnknownLocation { } diff --git a/cpp/ql/lib/semmle/code/cpp/Member.qll b/cpp/ql/lib/semmle/code/cpp/Member.qll deleted file mode 100644 index f47edbddeba0..000000000000 --- a/cpp/ql/lib/semmle/code/cpp/Member.qll +++ /dev/null @@ -1,6 +0,0 @@ -/** - * DEPRECATED: import `semmle.code.cpp.Element` and/or `semmle.code.cpp.Type` directly as required. - */ - -import semmle.code.cpp.Element -import semmle.code.cpp.Type diff --git a/cpp/ql/lib/semmle/code/cpp/TemplateParameter.qll b/cpp/ql/lib/semmle/code/cpp/TemplateParameter.qll index 6ece9cb82a46..e95b5b070731 100644 --- a/cpp/ql/lib/semmle/code/cpp/TemplateParameter.qll +++ b/cpp/ql/lib/semmle/code/cpp/TemplateParameter.qll @@ -35,13 +35,6 @@ class NonTypeTemplateParameter extends Literal, TemplateParameterImpl { override string getAPrimaryQlClass() { result = "NonTypeTemplateParameter" } } -/** - * A C++ `typename` (or `class`) template parameter. - * - * DEPRECATED: Use `TypeTemplateParameter` instead. - */ -deprecated class TemplateParameter = TypeTemplateParameter; - /** * A C++ `typename` (or `class`) template parameter. * diff --git a/cpp/ql/lib/semmle/code/cpp/internal/ResolveClass.qll b/cpp/ql/lib/semmle/code/cpp/internal/ResolveClass.qll index 9b2acc05e9e2..52c9aba7a868 100644 --- a/cpp/ql/lib/semmle/code/cpp/internal/ResolveClass.qll +++ b/cpp/ql/lib/semmle/code/cpp/internal/ResolveClass.qll @@ -1,59 +1,5 @@ import semmle.code.cpp.Type -/** For upgraded databases without mangled name info. */ -pragma[noinline] -private string getTopLevelClassName(@usertype c) { - not mangled_name(_, _, _) and - isClass(c) and - usertypes(c, result, _) and - not namespacembrs(_, c) and // not in a namespace - not member(_, _, c) and // not in some structure - not class_instantiation(c, _) // not a template instantiation -} - -/** - * For upgraded databases without mangled name info. - * Holds if `d` is a unique complete class named `name`. - */ -pragma[noinline] -private predicate existsCompleteWithName(string name, @usertype d) { - not mangled_name(_, _, _) and - is_complete(d) and - name = getTopLevelClassName(d) and - onlyOneCompleteClassExistsWithName(name) -} - -/** For upgraded databases without mangled name info. */ -pragma[noinline] -private predicate onlyOneCompleteClassExistsWithName(string name) { - not mangled_name(_, _, _) and - strictcount(@usertype c | is_complete(c) and getTopLevelClassName(c) = name) = 1 -} - -/** - * For upgraded databases without mangled name info. - * Holds if `c` is an incomplete class named `name`. - */ -pragma[noinline] -private predicate existsIncompleteWithName(string name, @usertype c) { - not mangled_name(_, _, _) and - not is_complete(c) and - name = getTopLevelClassName(c) -} - -/** - * For upgraded databases without mangled name info. - * Holds if `c` is an incomplete class, and there exists a unique complete class `d` - * with the same name. - */ -private predicate oldHasCompleteTwin(@usertype c, @usertype d) { - not mangled_name(_, _, _) and - exists(string name | - existsIncompleteWithName(name, c) and - existsCompleteWithName(name, d) - ) -} - pragma[noinline] private @mangledname getClassMangledName(@usertype c) { isClass(c) and @@ -103,10 +49,7 @@ private module Cached { @usertype resolveClass(@usertype c) { hasCompleteTwin(c, result) or - oldHasCompleteTwin(c, result) - or not hasCompleteTwin(c, _) and - not oldHasCompleteTwin(c, _) and result = c }