mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Swift: Support UnsafeCastExpr
This commit is contained in:
@@ -177,7 +177,7 @@ MAP(swift::Expr, ExprTag)
|
||||
MAP(swift::ABISafeConversionExpr, AbiSafeConversionExprTag) // different acronym convention
|
||||
MAP(swift::ActorIsolationErasureExpr, ActorIsolationErasureExprTag)
|
||||
MAP(swift::UnreachableExpr, UnreachableExprTag)
|
||||
MAP(swift::UnsafeCastExpr, void) // TODO swift 6.1
|
||||
MAP(swift::UnsafeCastExpr, UnsafeCastExprTag)
|
||||
MAP(swift::ExplicitCastExpr, ExplicitCastExprTag)
|
||||
MAP(swift::CheckedCastExpr, CheckedCastExprTag)
|
||||
MAP(swift::ForcedCheckedCastExpr, ForcedCheckedCastExprTag)
|
||||
|
||||
14
swift/ql/.generated.list
generated
14
swift/ql/.generated.list
generated
@@ -240,6 +240,7 @@ lib/codeql/swift/elements/expr/UnresolvedMemberExpr.qll 14bc154493999d866a3265d6
|
||||
lib/codeql/swift/elements/expr/UnresolvedPatternExpr.qll f27ef68f5bbb2d957513efdd43fb9c77987d4f7850b050d40faf5e0ab23cf9cd d9bad310caf43eb82ca294fcb43f1aaa4046ddc8ff9d6c46f65c9a6f798d30af
|
||||
lib/codeql/swift/elements/expr/UnresolvedSpecializeExpr.qll 9e1b27d90419e757480d0ae369bec1f159de3c28ddf760cdf24dd30b0ec6fcf9 1aeab5e10b1c3f081c5c3ca5bd807bfc38726a7b21b7201e0a9f997572935c73
|
||||
lib/codeql/swift/elements/expr/UnresolvedTypeConversionExpr.qll e259a187d70ea6b6007ebdd3659aa7e1947b2dc606642ccda27309ff74ffc3db c6a85856f82e74ed5597e381a5e4c27927eb4f01c7b588b1f4277dfb0e977521
|
||||
lib/codeql/swift/elements/expr/UnsafeCastExpr.qll 09c18a43f66432340b3212cb1933e096faf3825fa0a9abb30f7be11f170b6f97 93f35d500d67b71ed52d508ca9f7236c671f5b68a0ce6a0ee6a1a03d2b5db290
|
||||
lib/codeql/swift/elements/expr/VarargExpansionExpr.qll c7d7574caaac88fd73e69e82a84ca924e078eece0fd85a476b4a831e23b425f9 27213c88f864b7f8fd73edf8951e04a5ae7a57140a387df7c03dc1544ced723b
|
||||
lib/codeql/swift/elements/expr/internal/AbiSafeConversionExprConstructor.qll de9d2daf68b754e783374d017116606c8cd0710dbf8989d3606939e977dc672c 63c5ddb9da56da2c9637d7a0a6d9d069f745b4c095b07c9494a0b3a7e11be95b
|
||||
lib/codeql/swift/elements/expr/internal/AbiSafeConversionExprImpl.qll 6b2c51a5a5dd17044c6f5510048a9a2187aac9d35a70541faa9400406e35bc1e 448c23eec2ef44bd90e6c1636e3e881ca3447198eb68b8261412f42c4995b766
|
||||
@@ -425,6 +426,8 @@ lib/codeql/swift/elements/expr/internal/UnresolvedSpecializeExprConstructor.qll
|
||||
lib/codeql/swift/elements/expr/internal/UnresolvedSpecializeExprImpl.qll b1dc437410aa4a509ffc92cc0f63509e7bf698a52d79fc44a06230f185f22a97 a994738135b4118fadeb1a00c976772f777e7eeb4ecc0ab55e00676e0e1d507d
|
||||
lib/codeql/swift/elements/expr/internal/UnresolvedTypeConversionExprConstructor.qll 2d5a737ac25f4657d7fbc3be8ae927a44c01262e56fe49c161e73a7c015072b2 db3f463afb834181d618e8cc3773f0b174f17a0b29674cc8b1c3f5845c1317f9
|
||||
lib/codeql/swift/elements/expr/internal/UnresolvedTypeConversionExprImpl.qll 3511bf1bea3e3cee95c0793e40000493537076d76f235bfe91866e1e0caf97ab b97de4c795e873acee89d9b87d8c58b14e05f0c09e3a0385a479638adcf32966
|
||||
lib/codeql/swift/elements/expr/internal/UnsafeCastExprConstructor.qll f8771eb8f677003fc62a2f78dcdffc46ee5510001428dde58a7e9d82746b6f97 f20eb160de27d9413a3b5d7ace406fe5f6912ad5720db85d8a12c48c71e42b35
|
||||
lib/codeql/swift/elements/expr/internal/UnsafeCastExprImpl.qll 787104ce97d702c0c3efa81a0f8416584f35c454d3b2ffe7bd0917861589612b 50496a0f3f3a9e3d5a2e6cbcd5eb16b634cf3fd5e0878bdf017678243dbfd8a0
|
||||
lib/codeql/swift/elements/expr/internal/VarargExpansionExprConstructor.qll 917701083da11fce895c53d5f3e0a52b8e3142e9aacdf1d8536a4216ef377b16 b72ca103ced9cbb45f2ef9387387b8aaf3134e358ae5a03fa3ea242896954c81
|
||||
lib/codeql/swift/elements/internal/AvailabilityInfoConstructor.qll 89c731f266122a3434b88dfd573d68c50b5c4fa5e13c2443c54f78e682190d1e 86beb6f684e08b6f557b7d67bc164113e9f5270c09bbe95fbd81c558d77f7f84
|
||||
lib/codeql/swift/elements/internal/AvailabilitySpecImpl.qll 9ac9285e731938747c574c3f270aaead323656162bd34a6630c1babfaaf25a6a 900b2e638639f427506b2d0eb2806b6ee119ea63ea4ce44758e0c36f2ce915ac
|
||||
@@ -704,7 +707,7 @@ lib/codeql/swift/elements/type/internal/UnresolvedTypeImpl.qll ee1499dd568753898
|
||||
lib/codeql/swift/elements/type/internal/VariadicSequenceTypeConstructor.qll fc74a5a2a2effa28ef24509b20ee4373d97cf6e8c71840121bb031c6adedf584 c9b2effc1d01c13c5e6a74a111122fa79a2f6554dda3cb016d68ba397e566ec4
|
||||
lib/codeql/swift/elements/type/internal/WeakStorageTypeConstructor.qll 5fdce3716aba6318522174a2c455a63480970222ae81c732fb19c6dd3ae2d271 60ea79d6943e129deba0deccb566cf9d73f78398b0f7f0212674d91287d6b2ae
|
||||
lib/codeql/swift/elements/type/internal/WeakStorageTypeImpl.qll 74f79b458f3204ec2519bd654de21bc4fb6b76816bd8ca01990fe897563a1383 34e1810f74cecda5b580ed050438ae1d914b97a36b8f4e2de1c25254c0cac633
|
||||
lib/codeql/swift/elements.qll 9648ab501b413dc327513d9ed1d6e620a9eab6096e1130dc7e78cd6a2b6b549b 9648ab501b413dc327513d9ed1d6e620a9eab6096e1130dc7e78cd6a2b6b549b
|
||||
lib/codeql/swift/elements.qll 24dc5e00db9aa90fbabc9d2b20b7e3ed9e1cdbc826dbda89f332a83b19054f53 24dc5e00db9aa90fbabc9d2b20b7e3ed9e1cdbc826dbda89f332a83b19054f53
|
||||
lib/codeql/swift/generated/AstNode.qll 6fb80e9b230a1e3ae8193af40744f253d5cc81dc4239156924e5ab606c491efc e5c28418e9a38bde08f323a3986a199620189fc4a8a4dc8f670610a5d3d65b99
|
||||
lib/codeql/swift/generated/AvailabilityInfo.qll e3a5274c43e72ff124b6988fd8be0c83a41b89337e11104150dd0ca7f51d8a11 889563791ca8d9758dbbccf64a0731c4bdbf721cad32bc6cd723f1072b6aa1de
|
||||
lib/codeql/swift/generated/AvailabilitySpec.qll bc64d5c690c4d18800f0a48cc76a6a9ee4f832041343666da2d8df2aae04ed7e d03bf874293ac0ab09c025f75c0f392473d47bebe3223143adcc13882a366119
|
||||
@@ -721,12 +724,12 @@ lib/codeql/swift/generated/Locatable.qll 1d37fa20de71c0b9986bfd7a7c0cb82ab7bf3fd
|
||||
lib/codeql/swift/generated/Location.qll 5e20316c3e480ddfe632b7e88e016c19f10a67df1f6ae9c8f128755a6907d6f5 5a0af2d070bcb2ed53d6d0282bf9c60dc64c2dce89c21fdd485e9c7893c1c8fa
|
||||
lib/codeql/swift/generated/MacroRole.qll facf907e75490d69cd401c491215e4719324d751f40ea46c86ccf24cf3663c1f 969d8d4b44e3f1a9c193a152a4d83a303e56d2dbb871fc920c47a33f699cf018
|
||||
lib/codeql/swift/generated/OtherAvailabilitySpec.qll d9feaa2a71acff3184ca389045b0a49d09156210df0e034923d715b432ad594b 046737621a8bcf69bf805afb0cff476bd15259f12f0d77fce3206dd01b31518f
|
||||
lib/codeql/swift/generated/ParentChild.qll 7c9537f74a4c5a02622ce28c3de4b0ce02a7027d2e9aea9a860ece6a1e2ec340 49c1993b2a96df66903bffde78d63d8f4c68b2d604c419b20d88b63406366156
|
||||
lib/codeql/swift/generated/ParentChild.qll df9d71a00c137e89dd6a0caab75fea672fdf769ca60975d455aea85f2cb0e911 2a3495960938e3512cc10031b4c70b102c5ef8478528216fa27545b5ad37b9d7
|
||||
lib/codeql/swift/generated/PlatformVersionAvailabilitySpec.qll dc17b49a90a18a8f7607adf2433bc8f0c194fa3e803aa3822f809d4d4fbd6793 be48ea9f8ae17354c8508aaed24337a9e57ce01f288fece3dcecd99776cabcec
|
||||
lib/codeql/swift/generated/PureSynthConstructors.qll bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4 bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4
|
||||
lib/codeql/swift/generated/Raw.qll 6012194c54f8992401dffc0916b5790cdf581f18ac7b884379362dc807a52706 f9538fdfb326b715fdbc47e9e8b310df684d5a34519f751a65b3a4a75e430ce9
|
||||
lib/codeql/swift/generated/Synth.qll a14dddab40979df82d30b2d73407fe0058a803ed6e1a882cd9a6ae5ffd240526 0879d2476a42123b46eee216d4ea03523e0c04fe0b68d9a68e0046253edb1bc9
|
||||
lib/codeql/swift/generated/SynthConstructors.qll f64121911e082aa15478eb8779025cee96e97503724c02aff31741e65a894a4b f64121911e082aa15478eb8779025cee96e97503724c02aff31741e65a894a4b
|
||||
lib/codeql/swift/generated/Raw.qll 105d8abf7a4e7ffa9a421e17ca8eccf348a7fcfcc77b3a92e7e49750f0020284 271868257e2f48b743fc473ef3817611c3b112542a04f6e993fc4dfe34055b07
|
||||
lib/codeql/swift/generated/Synth.qll b1ef500787c05001ff7ddd6bdb3a5812ddc0ffa815906ae2e1c3f3a2416034ea 70f264bff132ece154200e81144f52377a7c65bd200c6aefd17d283bb29b9868
|
||||
lib/codeql/swift/generated/SynthConstructors.qll 2b242b849125bae5a0d19f19265882151a19120d43cc5b51398a5d5b520facaa 2b242b849125bae5a0d19f19265882151a19120d43cc5b51398a5d5b520facaa
|
||||
lib/codeql/swift/generated/UnknownFile.qll 247ddf2ebb49ce5ed4bf7bf91a969ddff37de6c78d43d8affccaf7eb586e06f2 452b29f0465ef45e978ef8b647b75e5a2a1e53f2a568fc003bc8f52f73b3fa4d
|
||||
lib/codeql/swift/generated/UnknownLocation.qll d871000b4f53ffca4f67ea23ca5626e5dcce125d62a4d4b9969e08cc974af6fc b05971d7774e60790362fb810fb7086314f40a2de747b8cb1bc823ec6494a4dd
|
||||
lib/codeql/swift/generated/UnspecifiedElement.qll d9ad4ba1ffff90cc465e8ba0dea8c4e8ba67dce5529b53b63ab6dc8e13c85e67 025218e1fee8ee382b63ad38009dfec73dc604d2ba80b9ad956c7c96eeed7022
|
||||
@@ -906,6 +909,7 @@ lib/codeql/swift/generated/expr/UnresolvedMemberExpr.qll 64a64c105b9b8b7bc0e1619
|
||||
lib/codeql/swift/generated/expr/UnresolvedPatternExpr.qll f197e1f19aa3b7641df8e9a7fcfe9f474282aadcb31172db8d76d2eb2449f7e1 5490ad6989b86f4f62657553e67d468bcbf60c1091bdac7fe0948bf6a22731fb
|
||||
lib/codeql/swift/generated/expr/UnresolvedSpecializeExpr.qll 5b6d9a88439442624051af347514b0a9fd5e932a440979778cf4072f71317770 a8f10642376f9ffa7f7cc73ca81e1a1f5905778a2752f20360f8a84f333dbfdd
|
||||
lib/codeql/swift/generated/expr/UnresolvedTypeConversionExpr.qll f30db08dbb5fce2bf6149238f608c62b51079c3694ed80d15ddcbecb2af75346 71b60e93c67f7b66468400ce9cc8714c9ead1bacaa7ce27e9df94542b41318f9
|
||||
lib/codeql/swift/generated/expr/UnsafeCastExpr.qll ec430464e1b6253dfcf0d17c08a01efae318b3f0c8beb7c977209504ccc2cc4f 48d5a80c96dfa71e091be2ce13ab7123997a37f8bcbaa6bde070493286f6b7f0
|
||||
lib/codeql/swift/generated/expr/VarargExpansionExpr.qll 3f382a545ef79ef5cd7eadf397f01524769d5fa0ee6410f1d92ff6b9985a99ff ffe8d0caec0226a13599de646f9e0c5f0e1af3c2b7ed480b327f2d51850e9e32
|
||||
lib/codeql/swift/generated/pattern/AnyPattern.qll af808c11b81a388f7d35bd98b6abf0fef45a1e1ec850cad16abb754c97c4da82 5c6cb800d4f026792a49fb84a3404f0797e599425bc54f474e3df6a948c18cfe
|
||||
lib/codeql/swift/generated/pattern/BindingPattern.qll ec7a78c6f2c2e56494d87c8865da2028cc65875edc516fdbdbde8f2fc80a28e7 df9988a745548d8920a78c0aca6692b24e6dad19251420208d050ee4eb39eee3
|
||||
|
||||
4
swift/ql/.gitattributes
generated
vendored
4
swift/ql/.gitattributes
generated
vendored
@@ -242,6 +242,7 @@
|
||||
/lib/codeql/swift/elements/expr/UnresolvedPatternExpr.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/UnresolvedSpecializeExpr.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/UnresolvedTypeConversionExpr.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/UnsafeCastExpr.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/VarargExpansionExpr.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/internal/AbiSafeConversionExprConstructor.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/internal/AbiSafeConversionExprImpl.qll linguist-generated
|
||||
@@ -427,6 +428,8 @@
|
||||
/lib/codeql/swift/elements/expr/internal/UnresolvedSpecializeExprImpl.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/internal/UnresolvedTypeConversionExprConstructor.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/internal/UnresolvedTypeConversionExprImpl.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/internal/UnsafeCastExprConstructor.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/internal/UnsafeCastExprImpl.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/internal/VarargExpansionExprConstructor.qll linguist-generated
|
||||
/lib/codeql/swift/elements/internal/AvailabilityInfoConstructor.qll linguist-generated
|
||||
/lib/codeql/swift/elements/internal/AvailabilitySpecImpl.qll linguist-generated
|
||||
@@ -908,6 +911,7 @@
|
||||
/lib/codeql/swift/generated/expr/UnresolvedPatternExpr.qll linguist-generated
|
||||
/lib/codeql/swift/generated/expr/UnresolvedSpecializeExpr.qll linguist-generated
|
||||
/lib/codeql/swift/generated/expr/UnresolvedTypeConversionExpr.qll linguist-generated
|
||||
/lib/codeql/swift/generated/expr/UnsafeCastExpr.qll linguist-generated
|
||||
/lib/codeql/swift/generated/expr/VarargExpansionExpr.qll linguist-generated
|
||||
/lib/codeql/swift/generated/pattern/AnyPattern.qll linguist-generated
|
||||
/lib/codeql/swift/generated/pattern/BindingPattern.qll linguist-generated
|
||||
|
||||
1
swift/ql/lib/codeql/swift/elements.qll
generated
1
swift/ql/lib/codeql/swift/elements.qll
generated
@@ -195,6 +195,7 @@ import codeql.swift.elements.expr.UnresolvedMemberExpr
|
||||
import codeql.swift.elements.expr.UnresolvedPatternExpr
|
||||
import codeql.swift.elements.expr.UnresolvedSpecializeExpr
|
||||
import codeql.swift.elements.expr.UnresolvedTypeConversionExpr
|
||||
import codeql.swift.elements.expr.UnsafeCastExpr
|
||||
import codeql.swift.elements.expr.VarargExpansionExpr
|
||||
import codeql.swift.elements.pattern.AnyPattern
|
||||
import codeql.swift.elements.pattern.BindingPattern
|
||||
|
||||
12
swift/ql/lib/codeql/swift/elements/expr/UnsafeCastExpr.qll
generated
Normal file
12
swift/ql/lib/codeql/swift/elements/expr/UnsafeCastExpr.qll
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
// generated by codegen/codegen.py, do not edit
|
||||
/**
|
||||
* This module provides the public class `UnsafeCastExpr`.
|
||||
*/
|
||||
|
||||
private import internal.UnsafeCastExprImpl
|
||||
import codeql.swift.elements.expr.ImplicitConversionExpr
|
||||
|
||||
/**
|
||||
* A conversion that performs an unsafe bitcast.
|
||||
*/
|
||||
final class UnsafeCastExpr = Impl::UnsafeCastExpr;
|
||||
14
swift/ql/lib/codeql/swift/elements/expr/internal/UnsafeCastExprConstructor.qll
generated
Normal file
14
swift/ql/lib/codeql/swift/elements/expr/internal/UnsafeCastExprConstructor.qll
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
/**
|
||||
* This module defines the hook used internally to tweak the characteristic predicate of
|
||||
* `UnsafeCastExpr` synthesized instances.
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
|
||||
private import codeql.swift.generated.Raw
|
||||
|
||||
/**
|
||||
* The characteristic predicate of `UnsafeCastExpr` synthesized instances.
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
predicate constructUnsafeCastExpr(Raw::UnsafeCastExpr id) { any() }
|
||||
19
swift/ql/lib/codeql/swift/elements/expr/internal/UnsafeCastExprImpl.qll
generated
Normal file
19
swift/ql/lib/codeql/swift/elements/expr/internal/UnsafeCastExprImpl.qll
generated
Normal file
@@ -0,0 +1,19 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
/**
|
||||
* This module provides a hand-modifiable wrapper around the generated class `UnsafeCastExpr`.
|
||||
*
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
|
||||
private import codeql.swift.generated.expr.UnsafeCastExpr
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the customizable definition of `UnsafeCastExpr` and should not
|
||||
* be referenced directly.
|
||||
*/
|
||||
module Impl {
|
||||
/**
|
||||
* A conversion that performs an unsafe bitcast.
|
||||
*/
|
||||
class UnsafeCastExpr extends Generated::UnsafeCastExpr { }
|
||||
}
|
||||
19
swift/ql/lib/codeql/swift/generated/ParentChild.qll
generated
19
swift/ql/lib/codeql/swift/generated/ParentChild.qll
generated
@@ -3169,6 +3169,23 @@ private module Impl {
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfUnsafeCastExpr(
|
||||
UnsafeCastExpr e, int index, string partialPredicateCall
|
||||
) {
|
||||
exists(int b, int bImplicitConversionExpr, int n |
|
||||
b = 0 and
|
||||
bImplicitConversionExpr =
|
||||
b + 1 +
|
||||
max(int i | i = -1 or exists(getImmediateChildOfImplicitConversionExpr(e, i, _)) | i) and
|
||||
n = bImplicitConversionExpr and
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfImplicitConversionExpr(e, index - b, partialPredicateCall)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfBooleanLiteralExpr(
|
||||
BooleanLiteralExpr e, int index, string partialPredicateCall
|
||||
) {
|
||||
@@ -5493,6 +5510,8 @@ private module Impl {
|
||||
or
|
||||
result = getImmediateChildOfUnresolvedTypeConversionExpr(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfUnsafeCastExpr(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfBooleanLiteralExpr(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfConditionalCheckedCastExpr(e, index, partialAccessor)
|
||||
|
||||
8
swift/ql/lib/codeql/swift/generated/Raw.qll
generated
8
swift/ql/lib/codeql/swift/generated/Raw.qll
generated
@@ -2488,6 +2488,14 @@ module Raw {
|
||||
override string toString() { result = "UnresolvedTypeConversionExpr" }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A conversion that performs an unsafe bitcast.
|
||||
*/
|
||||
class UnsafeCastExpr extends @unsafe_cast_expr, ImplicitConversionExpr {
|
||||
override string toString() { result = "UnsafeCastExpr" }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
|
||||
22
swift/ql/lib/codeql/swift/generated/Synth.qll
generated
22
swift/ql/lib/codeql/swift/generated/Synth.qll
generated
@@ -716,6 +716,10 @@ module Synth {
|
||||
TUnresolvedTypeConversionExpr(Raw::UnresolvedTypeConversionExpr id) {
|
||||
constructUnresolvedTypeConversionExpr(id)
|
||||
} or
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
TUnsafeCastExpr(Raw::UnsafeCastExpr id) { constructUnsafeCastExpr(id) } or
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
@@ -1288,7 +1292,7 @@ module Synth {
|
||||
TLinearToDifferentiableFunctionExpr or TLoadExpr or TMetatypeConversionExpr or
|
||||
TPointerToPointerExpr or TProtocolMetatypeToObjectExpr or TStringToPointerExpr or
|
||||
TUnderlyingToOpaqueExpr or TUnevaluatedInstanceExpr or TUnreachableExpr or
|
||||
TUnresolvedTypeConversionExpr;
|
||||
TUnresolvedTypeConversionExpr or TUnsafeCastExpr;
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
@@ -2561,6 +2565,12 @@ module Synth {
|
||||
result = TUnresolvedTypeConversionExpr(e)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a raw element to a synthesized `TUnsafeCastExpr`, if possible.
|
||||
*/
|
||||
TUnsafeCastExpr convertUnsafeCastExprFromRaw(Raw::Element e) { result = TUnsafeCastExpr(e) }
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a raw element to a synthesized `TVarargExpansionExpr`, if possible.
|
||||
@@ -3765,6 +3775,8 @@ module Synth {
|
||||
result = convertUnreachableExprFromRaw(e)
|
||||
or
|
||||
result = convertUnresolvedTypeConversionExprFromRaw(e)
|
||||
or
|
||||
result = convertUnsafeCastExprFromRaw(e)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5269,6 +5281,12 @@ module Synth {
|
||||
e = TUnresolvedTypeConversionExpr(result)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a synthesized `TUnsafeCastExpr` to a raw DB element, if possible.
|
||||
*/
|
||||
Raw::Element convertUnsafeCastExprToRaw(TUnsafeCastExpr e) { e = TUnsafeCastExpr(result) }
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a synthesized `TVarargExpansionExpr` to a raw DB element, if possible.
|
||||
@@ -6473,6 +6491,8 @@ module Synth {
|
||||
result = convertUnreachableExprToRaw(e)
|
||||
or
|
||||
result = convertUnresolvedTypeConversionExprToRaw(e)
|
||||
or
|
||||
result = convertUnsafeCastExprToRaw(e)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -162,6 +162,7 @@ import codeql.swift.elements.expr.internal.UnresolvedMemberExprConstructor
|
||||
import codeql.swift.elements.expr.internal.UnresolvedPatternExprConstructor
|
||||
import codeql.swift.elements.expr.internal.UnresolvedSpecializeExprConstructor
|
||||
import codeql.swift.elements.expr.internal.UnresolvedTypeConversionExprConstructor
|
||||
import codeql.swift.elements.expr.internal.UnsafeCastExprConstructor
|
||||
import codeql.swift.elements.expr.internal.VarargExpansionExprConstructor
|
||||
import codeql.swift.elements.pattern.internal.AnyPatternConstructor
|
||||
import codeql.swift.elements.pattern.internal.BindingPatternConstructor
|
||||
|
||||
26
swift/ql/lib/codeql/swift/generated/expr/UnsafeCastExpr.qll
generated
Normal file
26
swift/ql/lib/codeql/swift/generated/expr/UnsafeCastExpr.qll
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
// generated by codegen/codegen.py, do not edit
|
||||
/**
|
||||
* This module provides the generated definition of `UnsafeCastExpr`.
|
||||
* INTERNAL: Do not import directly.
|
||||
*/
|
||||
|
||||
private import codeql.swift.generated.Synth
|
||||
private import codeql.swift.generated.Raw
|
||||
import codeql.swift.elements.expr.internal.ImplicitConversionExprImpl::Impl as ImplicitConversionExprImpl
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the fully generated definition of `UnsafeCastExpr` and should not
|
||||
* be referenced directly.
|
||||
*/
|
||||
module Generated {
|
||||
/**
|
||||
* A conversion that performs an unsafe bitcast.
|
||||
* INTERNAL: Do not reference the `Generated::UnsafeCastExpr` class directly.
|
||||
* Use the subclass `UnsafeCastExpr`, where the following predicates are available.
|
||||
*/
|
||||
class UnsafeCastExpr extends Synth::TUnsafeCastExpr,
|
||||
ImplicitConversionExprImpl::ImplicitConversionExpr
|
||||
{
|
||||
override string getAPrimaryQlClass() { result = "UnsafeCastExpr" }
|
||||
}
|
||||
}
|
||||
5
swift/ql/lib/swift.dbscheme
generated
5
swift/ql/lib/swift.dbscheme
generated
@@ -1067,6 +1067,7 @@ if_exprs( //dir=expr
|
||||
| @unevaluated_instance_expr
|
||||
| @unreachable_expr
|
||||
| @unresolved_type_conversion_expr
|
||||
| @unsafe_cast_expr
|
||||
;
|
||||
|
||||
#keyset[id]
|
||||
@@ -1656,6 +1657,10 @@ unresolved_type_conversion_exprs( //dir=expr
|
||||
unique int id: @unresolved_type_conversion_expr
|
||||
);
|
||||
|
||||
unsafe_cast_exprs( //dir=expr
|
||||
unique int id: @unsafe_cast_expr
|
||||
);
|
||||
|
||||
boolean_literal_exprs( //dir=expr
|
||||
unique int id: @boolean_literal_expr,
|
||||
boolean value: boolean ref
|
||||
|
||||
@@ -3,3 +3,5 @@
|
||||
| implicit_conversions.swift:5:25:5:25 | (any Equatable) ... | ErasureExpr | hasType: | yes | getSubExpr: | implicit_conversions.swift:5:25:5:25 | 42 |
|
||||
| implicit_conversions.swift:12:3:12:5 | (@lvalue (() -> Void)?) ... | AbiSafeConversionExpr | hasType: | yes | getSubExpr: | implicit_conversions.swift:12:3:12:5 | .b |
|
||||
| implicit_conversions.swift:12:9:12:10 | ((() -> Void)?) ... | InjectIntoOptionalExpr | hasType: | yes | getSubExpr: | implicit_conversions.swift:12:9:12:10 | { ... } |
|
||||
| implicit_conversions.swift:24:3:24:5 | (Array<Any>) ... | UnsafeCastExpr | hasType: | yes | getSubExpr: | implicit_conversions.swift:24:3:24:5 | ([any Sendable]) ... |
|
||||
| implicit_conversions.swift:24:3:24:5 | ([any Sendable]) ... | LoadExpr | hasType: | yes | getSubExpr: | implicit_conversions.swift:24:3:24:5 | .a |
|
||||
|
||||
@@ -3,3 +3,5 @@
|
||||
| implicit_conversions.swift:5:25:5:25 | (any Equatable) ... | any Equatable |
|
||||
| implicit_conversions.swift:12:3:12:5 | (@lvalue (() -> Void)?) ... | @lvalue (() -> Void)? |
|
||||
| implicit_conversions.swift:12:9:12:10 | ((() -> Void)?) ... | (() -> Void)? |
|
||||
| implicit_conversions.swift:24:3:24:5 | (Array<Any>) ... | Array<Any> |
|
||||
| implicit_conversions.swift:24:3:24:5 | ([any Sendable]) ... | [any Sendable] |
|
||||
|
||||
@@ -12,3 +12,14 @@ func g(_ a: A) {
|
||||
a.b = {}
|
||||
}
|
||||
|
||||
class B {
|
||||
@preconcurrency var a: [any Sendable] = []
|
||||
}
|
||||
|
||||
extension Array where Element == Any {
|
||||
func h() {}
|
||||
}
|
||||
|
||||
func i(b: B) {
|
||||
b.a.h()
|
||||
}
|
||||
|
||||
@@ -1463,3 +1463,9 @@ class UnreachableExpr(ImplicitConversionExpr):
|
||||
"""
|
||||
A conversion from the uninhabited type to any other type. It's never evaluated.
|
||||
"""
|
||||
|
||||
|
||||
class UnsafeCastExpr(ImplicitConversionExpr):
|
||||
"""
|
||||
A conversion that performs an unsafe bitcast.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user