From dd21dab0555fc8e216a0ad3bf4701e9756b99097 Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Wed, 12 Mar 2025 10:04:33 +0100 Subject: [PATCH] Swift: Add `get(Immediate)Child` predicate --- swift/ql/.generated.list | 2 +- swift/ql/lib/codeql/swift/generated/ParentChild.qll | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/swift/ql/.generated.list b/swift/ql/.generated.list index 693c18c83e7..6c086a490ad 100644 --- a/swift/ql/.generated.list +++ b/swift/ql/.generated.list @@ -709,7 +709,7 @@ lib/codeql/swift/generated/Locatable.qll 1d37fa20de71c0b9986bfd7a7c0cb82ab7bf3fd lib/codeql/swift/generated/Location.qll 5e20316c3e480ddfe632b7e88e016c19f10a67df1f6ae9c8f128755a6907d6f5 5a0af2d070bcb2ed53d6d0282bf9c60dc64c2dce89c21fdd485e9c7893c1c8fa lib/codeql/swift/generated/MacroRole.qll 0d8fa6b0b6e2045d9097a87d53888cae2ea5371b2fa7d140341cf206f575b556 ea3b8a7c0a88851809f9a5a5aa80b0d2da3c4779bb29044cdba2b60246a2722c lib/codeql/swift/generated/OtherAvailabilitySpec.qll d9feaa2a71acff3184ca389045b0a49d09156210df0e034923d715b432ad594b 046737621a8bcf69bf805afb0cff476bd15259f12f0d77fce3206dd01b31518f -lib/codeql/swift/generated/ParentChild.qll b65c29ba8c3e13baac44a32d2521a11f07aeb7d33415aa9a91a7f6255a744415 0fe73d06c96194d5a0da19c9348a46d9f8fbf630fee5de3dc96e997c595c362e +lib/codeql/swift/generated/ParentChild.qll bafa2e366c0df25d6c26c4e2e2b84f3e363524d7abcf0f6e31e42879f2bc664a 616160f5664f77346992c2ac39e3229abdf186fe707066d4895ceddd148749a9 lib/codeql/swift/generated/PlatformVersionAvailabilitySpec.qll dc17b49a90a18a8f7607adf2433bc8f0c194fa3e803aa3822f809d4d4fbd6793 be48ea9f8ae17354c8508aaed24337a9e57ce01f288fece3dcecd99776cabcec lib/codeql/swift/generated/PureSynthConstructors.qll bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4 bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4 lib/codeql/swift/generated/Raw.qll 4f2ddadd2ced9728aaf4595ccf85cd147468d7ad0a57a21a6cbfd04e3834b386 9653595693da55953d7743fbecce33d16910e3b6737c654311f1e34d27ad7f0b diff --git a/swift/ql/lib/codeql/swift/generated/ParentChild.qll b/swift/ql/lib/codeql/swift/generated/ParentChild.qll index 8f2d6fb5357..13e75c26239 100644 --- a/swift/ql/lib/codeql/swift/generated/ParentChild.qll +++ b/swift/ql/lib/codeql/swift/generated/ParentChild.qll @@ -5630,6 +5630,11 @@ Element getImmediateParent(Element e) { result = unique(Element x | e = Impl::getImmediateChild(x, _, _) | x) } +/** + * Gets the immediate child indexed at `index`. Indexes are not guaranteed to be contiguous, but are guaranteed to be distinct. + */ +Element getImmediateChild(Element e, int index) { result = Impl::getImmediateChild(e, index, _) } + /** * Gets the immediate child indexed at `index`. Indexes are not guaranteed to be contiguous, but are guaranteed to be distinct. `accessor` is bound the member predicate call resulting in the given child. */ @@ -5649,3 +5654,8 @@ Element getChildAndAccessor(Element e, int index, string accessor) { accessor = "get" + partialAccessor ) } + +/** + * Gets the child indexed at `index`. Indexes are not guaranteed to be contiguous, but are guaranteed to be distinct. `accessor` is bound the member predicate call resulting in the given child. + */ +Element getChild(Element e, int index) { result = Impl::getImmediateChild(e, index, _).resolve() }