From 357007ad89b1428df31db8266879f74aae877d4e Mon Sep 17 00:00:00 2001 From: Jeroen Ketema <93738568+jketema@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:29:07 +0000 Subject: [PATCH] Swift: Remove outdated deprecated library APIs Remove obsolete indexed base-type, named-pattern, and basic-block control predicates identified by config/blame-deprecations.mjs; the replacement inherited-type, variable, and edge-dominance APIs remain unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7be1d7da-9061-47a8-bf98-b3169476add9 --- .../2026-11-18-outdated-deprecations.md | 4 +++ .../codeql/swift/controlflow/BasicBlocks.qll | 26 +------------------ .../elements/decl/internal/TypeDeclImpl.qll | 25 ------------------ .../pattern/internal/NamedPatternImpl.qll | 7 ----- 4 files changed, 5 insertions(+), 57 deletions(-) create mode 100644 swift/ql/lib/change-notes/2026-11-18-outdated-deprecations.md diff --git a/swift/ql/lib/change-notes/2026-11-18-outdated-deprecations.md b/swift/ql/lib/change-notes/2026-11-18-outdated-deprecations.md new file mode 100644 index 000000000000..6ebeb46efae9 --- /dev/null +++ b/swift/ql/lib/change-notes/2026-11-18-outdated-deprecations.md @@ -0,0 +1,4 @@ +--- +category: breaking +--- +* Removed the deprecated `getImmediateBaseType`, `getBaseType`, and `getBaseTypeDecl` predicates on type declarations, `hasVarDecl` on named patterns, and `immediatelyControls` and `controls` on basic blocks. Use `getImmediateInheritedType`, `getInheritedType`, `getABaseTypeDecl`, `getVarDecl`, and `edgeDominates`, respectively, instead. diff --git a/swift/ql/lib/codeql/swift/controlflow/BasicBlocks.qll b/swift/ql/lib/codeql/swift/controlflow/BasicBlocks.qll index e5acea49fdad..c1e5bc2299b2 100644 --- a/swift/ql/lib/codeql/swift/controlflow/BasicBlocks.qll +++ b/swift/ql/lib/codeql/swift/controlflow/BasicBlocks.qll @@ -87,31 +87,7 @@ final class JoinBlock extends BasicBlock, BasicBlocksImpl::JoinBasicBlock { class JoinBlockPredecessor extends BasicBlock, BasicBlocksImpl::JoinPredecessorBasicBlock { } /** A basic block that terminates in a condition, splitting the subsequent control flow. */ -final class ConditionBlock extends BasicBlock, BasicBlocksImpl::ConditionBasicBlock { - /** - * DEPRECATED: Use `edgeDominates` instead. - * - * Holds if basic block `succ` is immediately controlled by this basic - * block with conditional value `s`. That is, `succ` is an immediate - * successor of this block, and `succ` can only be reached from - * the callable entry point by going via the `s` edge out of this basic block. - */ - deprecated predicate immediatelyControls(BasicBlock succ, ConditionalSuccessor s) { - this.getASuccessor(s) = succ and - BasicBlocksImpl::dominatingEdge(this, succ) - } - - /** - * DEPRECATED: Use `edgeDominates` instead. - * - * Holds if basic block `controlled` is controlled by this basic block with - * conditional value `s`. That is, `controlled` can only be reached from - * the callable entry point by going via the `s` edge out of this basic block. - */ - deprecated predicate controls(BasicBlock controlled, ConditionalSuccessor s) { - super.edgeDominates(controlled, s) - } -} +final class ConditionBlock extends BasicBlock, BasicBlocksImpl::ConditionBasicBlock { } private class BasicBlockAlias = BasicBlock; diff --git a/swift/ql/lib/codeql/swift/elements/decl/internal/TypeDeclImpl.qll b/swift/ql/lib/codeql/swift/elements/decl/internal/TypeDeclImpl.qll index d47742cab1ed..2340c8dcb229 100644 --- a/swift/ql/lib/codeql/swift/elements/decl/internal/TypeDeclImpl.qll +++ b/swift/ql/lib/codeql/swift/elements/decl/internal/TypeDeclImpl.qll @@ -20,23 +20,6 @@ module Impl { class TypeDecl extends Generated::TypeDecl { override string toStringImpl() { result = this.getName() } - /** - * Gets the `index`th base type of this type declaration (0-based). - * - * This is the same as `getImmediateInheritedType`. - * DEPRECATED: either use `getImmediateInheritedType` or unindexed `getABaseType`. - */ - deprecated Type getImmediateBaseType(int index) { - result = this.getImmediateInheritedType(index) - } - - /** - * Gets the `index`th base type of this type declaration (0-based). - * This is the same as `getInheritedType`. - * DEPRECATED: use `getInheritedType` or unindexed `getABaseType`. - */ - deprecated Type getBaseType(int index) { result = this.getInheritedType(index) } - /** * Gets any of the base types of this type declaration. Expands protocols added in * extensions and expands type aliases. For example in the following code, `B` has @@ -58,14 +41,6 @@ module Impl { ) } - /** - * Gets the declaration of the `index`th base type of this type declaration (0-based). - * DEPRECATED: The index is not very meaningful here. Use `getABaseTypeDecl`. - */ - deprecated TypeDecl getBaseTypeDecl(int i) { - result = this.getBaseType(i).(AnyGenericType).getDeclaration() - } - /** * Gets the declaration of any of the base types of this type declaration. Expands * protocols added in extensions and expands type aliases. For example in the following diff --git a/swift/ql/lib/codeql/swift/elements/pattern/internal/NamedPatternImpl.qll b/swift/ql/lib/codeql/swift/elements/pattern/internal/NamedPatternImpl.qll index d4453cb42ff4..c534cb6b9d25 100644 --- a/swift/ql/lib/codeql/swift/elements/pattern/internal/NamedPatternImpl.qll +++ b/swift/ql/lib/codeql/swift/elements/pattern/internal/NamedPatternImpl.qll @@ -9,13 +9,6 @@ module Impl { * whereas `y` as in `if case .some(y) = ...` is instead an `ExprPattern`. */ class NamedPattern extends Generated::NamedPattern { - /** - * Holds if this named pattern has a corresponding `VarDecl`, which is currently always true. - * - * DEPRECATED: unless there was a compilation error, this will always hold. - */ - deprecated predicate hasVarDecl() { exists(this.getVarDecl()) } - /** * Gets the name of the variable bound by this pattern. */