mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Swift: Support UnsafeExpr
This commit is contained in:
@@ -103,7 +103,7 @@ MAP(swift::Expr, ExprTag)
|
||||
MAP(swift::ParenExpr, ParenExprTag)
|
||||
MAP(swift::DotSelfExpr, DotSelfExprTag)
|
||||
MAP(swift::AwaitExpr, AwaitExprTag)
|
||||
MAP(swift::UnsafeExpr, void) // TODO: Swift 6.2
|
||||
MAP(swift::UnsafeExpr, UnsafeExprTag)
|
||||
MAP(swift::BorrowExpr, BorrowExprTag)
|
||||
MAP(swift::UnresolvedMemberChainResultExpr, UnresolvedMemberChainResultExprTag)
|
||||
MAP(swift::AnyTryExpr, AnyTryExprTag)
|
||||
|
||||
14
swift/ql/.generated.list
generated
14
swift/ql/.generated.list
generated
@@ -240,6 +240,7 @@ lib/codeql/swift/elements/expr/UnresolvedPatternExpr.qll f27ef68f5bbb2d957513efd
|
||||
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/UnsafeExpr.qll 49f076af1e154ff5eb6588f77e6532e75b4b6d9710185443fd48740bc5aaba99 7c558095d3be8401aa4d9065bd86110959cbced7f5d65f8120530d5497b3de15
|
||||
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
|
||||
@@ -429,6 +430,8 @@ lib/codeql/swift/elements/expr/internal/UnresolvedTypeConversionExprConstructor.
|
||||
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/UnsafeExprConstructor.qll e7644366f93dfab6ae13910908a18a3a79aa7aee728c62da0bda158fe18279dd 7b9d866b762e1b49a9fa3320247b6c9f8d3f80283e2521c58a422dc73a15f6ce
|
||||
lib/codeql/swift/elements/expr/internal/UnsafeExprImpl.qll bae39cfbca303a18001397aa5f24c9ae59cd6c722e0db9488c48173027529a8a f0de29ed4b8b53b5b6f0cabf94d64eb3559f6b5462fe80bcbce062c7588371fb
|
||||
lib/codeql/swift/elements/expr/internal/VarargExpansionExprConstructor.qll 917701083da11fce895c53d5f3e0a52b8e3142e9aacdf1d8536a4216ef377b16 b72ca103ced9cbb45f2ef9387387b8aaf3134e358ae5a03fa3ea242896954c81
|
||||
lib/codeql/swift/elements/internal/AvailabilityInfoConstructor.qll 89c731f266122a3434b88dfd573d68c50b5c4fa5e13c2443c54f78e682190d1e 86beb6f684e08b6f557b7d67bc164113e9f5270c09bbe95fbd81c558d77f7f84
|
||||
lib/codeql/swift/elements/internal/AvailabilitySpecConstructor.qll cca46cd2908923a08b7f6a8bea0c0c11071523bcc421bfe141d0e0bafd8dfcb4 cbb1494346379083c0f275111eca78617591568894258a6b73efda34f3fba1ba
|
||||
@@ -712,7 +715,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 84a5704b697f4a3f224ec2b99d49f4d2a6ee2655aa86c72ea1cbc901b8231879 84a5704b697f4a3f224ec2b99d49f4d2a6ee2655aa86c72ea1cbc901b8231879
|
||||
lib/codeql/swift/elements.qll 235d28a76c1799946a30bfe800bada394b61294692d2de14977f8eb08e404a3b 235d28a76c1799946a30bfe800bada394b61294692d2de14977f8eb08e404a3b
|
||||
lib/codeql/swift/generated/AstNode.qll 6fb80e9b230a1e3ae8193af40744f253d5cc81dc4239156924e5ab606c491efc e5c28418e9a38bde08f323a3986a199620189fc4a8a4dc8f670610a5d3d65b99
|
||||
lib/codeql/swift/generated/AvailabilityInfo.qll e3a5274c43e72ff124b6988fd8be0c83a41b89337e11104150dd0ca7f51d8a11 889563791ca8d9758dbbccf64a0731c4bdbf721cad32bc6cd723f1072b6aa1de
|
||||
lib/codeql/swift/generated/AvailabilitySpec.qll 1bd2a0ee085f802c99090e681ab3339fc5013024d79deef39f376de12ab76d37 658f2eb51860726cfa6808b3e3501d624e0734750d1420f7a25c89782f1f6c7e
|
||||
@@ -728,11 +731,11 @@ lib/codeql/swift/generated/KeyPathComponent.qll e11dcf952045b5e6062e24c23515cff9
|
||||
lib/codeql/swift/generated/Locatable.qll 1d37fa20de71c0b9986bfd7a7c0cb82ab7bf3fda2d2008700f955ad82ce109a7 e97d4d4fb8a4800e0008cc00f60c8ed9b1ebd5f1140fd85e68b034616178d721
|
||||
lib/codeql/swift/generated/Location.qll 5e20316c3e480ddfe632b7e88e016c19f10a67df1f6ae9c8f128755a6907d6f5 5a0af2d070bcb2ed53d6d0282bf9c60dc64c2dce89c21fdd485e9c7893c1c8fa
|
||||
lib/codeql/swift/generated/MacroRole.qll facf907e75490d69cd401c491215e4719324d751f40ea46c86ccf24cf3663c1f 969d8d4b44e3f1a9c193a152a4d83a303e56d2dbb871fc920c47a33f699cf018
|
||||
lib/codeql/swift/generated/ParentChild.qll 88a8941821b1f511925eb8955ff25065a6004c61aa866854ee941d7556b1eb6d 6e32b4902cea8a78a9b2775826d64300987932c406212d841deeab7c48a5ef8b
|
||||
lib/codeql/swift/generated/ParentChild.qll d136a88003d899184c4d9c9d88d4ab8fe0f66d5499dc36408e94e801a7a69977 e22fd02176b000e7797d535c9609e309d55f878cffdc0aead44b33ab9c0aa3da
|
||||
lib/codeql/swift/generated/PureSynthConstructors.qll bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4 bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4
|
||||
lib/codeql/swift/generated/Raw.qll 9cbbea49cef2a47eb3414a14f42571c7bef60fa816a4cec0e3f34206b7ceafa1 86cc2bf1675dfccacf6041ad343b0642650dd38f2956a9e7bd2bb3d0f2cd90d1
|
||||
lib/codeql/swift/generated/Synth.qll a472fca73084eedab9ca8bb2fb82e7573d525444bb8d3729a3d18e06647fd96d b19984583774e30dae481d3d5cc95ebf2843c04dd952eb16cbf8a702ae52bbd8
|
||||
lib/codeql/swift/generated/SynthConstructors.qll f3687a56d2fd9bc38d95d9ca335f558a91c865bd0bd1c7c73affedefd7514183 f3687a56d2fd9bc38d95d9ca335f558a91c865bd0bd1c7c73affedefd7514183
|
||||
lib/codeql/swift/generated/Raw.qll cd9af8d346b1c9b1ed7dbcce0689501ebb5c3664c05ada9ef74d0384d8fb7631 614d653e9a61b574ac5a4c7aaa6d686679532248d281dfd6f16b4dc0c2d04de5
|
||||
lib/codeql/swift/generated/Synth.qll adf8b1d9b1548ff3108e9f781e984475199d13b9f76001f04e76f3f47172c963 73dec964f00acde797be627aeb7af8f60589fb2c43f94faedd71861b9d07e704
|
||||
lib/codeql/swift/generated/SynthConstructors.qll 05012c9dd9aa8c8ce9e12ad2e5791864de310efdd05150cfba2c925d6df672cd 05012c9dd9aa8c8ce9e12ad2e5791864de310efdd05150cfba2c925d6df672cd
|
||||
lib/codeql/swift/generated/UnknownFile.qll 247ddf2ebb49ce5ed4bf7bf91a969ddff37de6c78d43d8affccaf7eb586e06f2 452b29f0465ef45e978ef8b647b75e5a2a1e53f2a568fc003bc8f52f73b3fa4d
|
||||
lib/codeql/swift/generated/UnknownLocation.qll d871000b4f53ffca4f67ea23ca5626e5dcce125d62a4d4b9969e08cc974af6fc b05971d7774e60790362fb810fb7086314f40a2de747b8cb1bc823ec6494a4dd
|
||||
lib/codeql/swift/generated/UnspecifiedElement.qll d9ad4ba1ffff90cc465e8ba0dea8c4e8ba67dce5529b53b63ab6dc8e13c85e67 025218e1fee8ee382b63ad38009dfec73dc604d2ba80b9ad956c7c96eeed7022
|
||||
@@ -914,6 +917,7 @@ lib/codeql/swift/generated/expr/UnresolvedPatternExpr.qll f197e1f19aa3b7641df8e9
|
||||
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/UnsafeExpr.qll 5c81d5ebcd95bb217703298b25741b84804d52536cbc70ddf51896cc8e84441c 9bfacf26cc4aa119a47db4b968e81e0db45aecf48390eb67d690053700aecfcb
|
||||
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/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/UnsafeExpr.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
|
||||
@@ -431,6 +432,8 @@
|
||||
/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/UnsafeExprConstructor.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/internal/UnsafeExprImpl.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/AvailabilitySpecConstructor.qll linguist-generated
|
||||
@@ -916,6 +919,7 @@
|
||||
/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/UnsafeExpr.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.UnresolvedPatternExpr
|
||||
import codeql.swift.elements.expr.UnresolvedSpecializeExpr
|
||||
import codeql.swift.elements.expr.UnresolvedTypeConversionExpr
|
||||
import codeql.swift.elements.expr.UnsafeCastExpr
|
||||
import codeql.swift.elements.expr.UnsafeExpr
|
||||
import codeql.swift.elements.expr.VarargExpansionExpr
|
||||
import codeql.swift.elements.pattern.AnyPattern
|
||||
import codeql.swift.elements.pattern.BindingPattern
|
||||
|
||||
9
swift/ql/lib/codeql/swift/elements/expr/UnsafeExpr.qll
generated
Normal file
9
swift/ql/lib/codeql/swift/elements/expr/UnsafeExpr.qll
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
// generated by codegen/codegen.py, do not edit
|
||||
/**
|
||||
* This module provides the public class `UnsafeExpr`.
|
||||
*/
|
||||
|
||||
private import internal.UnsafeExprImpl
|
||||
import codeql.swift.elements.expr.IdentityExpr
|
||||
|
||||
final class UnsafeExpr = Impl::UnsafeExpr;
|
||||
14
swift/ql/lib/codeql/swift/elements/expr/internal/UnsafeExprConstructor.qll
generated
Normal file
14
swift/ql/lib/codeql/swift/elements/expr/internal/UnsafeExprConstructor.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
|
||||
* `UnsafeExpr` synthesized instances.
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
|
||||
private import codeql.swift.generated.Raw
|
||||
|
||||
/**
|
||||
* The characteristic predicate of `UnsafeExpr` synthesized instances.
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
predicate constructUnsafeExpr(Raw::UnsafeExpr id) { any() }
|
||||
16
swift/ql/lib/codeql/swift/elements/expr/internal/UnsafeExprImpl.qll
generated
Normal file
16
swift/ql/lib/codeql/swift/elements/expr/internal/UnsafeExprImpl.qll
generated
Normal file
@@ -0,0 +1,16 @@
|
||||
// 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 `UnsafeExpr`.
|
||||
*
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
|
||||
private import codeql.swift.generated.expr.UnsafeExpr
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the customizable definition of `UnsafeExpr` and should not
|
||||
* be referenced directly.
|
||||
*/
|
||||
module Impl {
|
||||
class UnsafeExpr extends Generated::UnsafeExpr { }
|
||||
}
|
||||
14
swift/ql/lib/codeql/swift/generated/ParentChild.qll
generated
14
swift/ql/lib/codeql/swift/generated/ParentChild.qll
generated
@@ -2235,6 +2235,18 @@ private module Impl {
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfUnsafeExpr(UnsafeExpr e, int index, string partialPredicateCall) {
|
||||
exists(int n, int nSubExpr |
|
||||
n = 0 and
|
||||
nSubExpr = n + 1 and
|
||||
(
|
||||
none()
|
||||
or
|
||||
index = n and result = e.getImmediateSubExpr() and partialPredicateCall = "SubExpr()"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfBooleanLiteralExpr(
|
||||
BooleanLiteralExpr e, int index, string partialPredicateCall
|
||||
) {
|
||||
@@ -3470,6 +3482,8 @@ private module Impl {
|
||||
or
|
||||
result = getImmediateChildOfUnsafeCastExpr(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfUnsafeExpr(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfBooleanLiteralExpr(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfConditionalCheckedCastExpr(e, index, partialAccessor)
|
||||
|
||||
7
swift/ql/lib/codeql/swift/generated/Raw.qll
generated
7
swift/ql/lib/codeql/swift/generated/Raw.qll
generated
@@ -2517,6 +2517,13 @@ module Raw {
|
||||
override string toString() { result = "UnsafeCastExpr" }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
class UnsafeExpr extends @unsafe_expr, IdentityExpr {
|
||||
override string toString() { result = "UnsafeExpr" }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
|
||||
23
swift/ql/lib/codeql/swift/generated/Synth.qll
generated
23
swift/ql/lib/codeql/swift/generated/Synth.qll
generated
@@ -718,6 +718,10 @@ module Synth {
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
TUnsafeCastExpr(Raw::UnsafeCastExpr id) { constructUnsafeCastExpr(id) } or
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
TUnsafeExpr(Raw::UnsafeExpr id) { constructUnsafeExpr(id) } or
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
@@ -1277,7 +1281,8 @@ module Synth {
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
class TIdentityExpr =
|
||||
TAwaitExpr or TBorrowExpr or TDotSelfExpr or TParenExpr or TUnresolvedMemberChainResultExpr;
|
||||
TAwaitExpr or TBorrowExpr or TDotSelfExpr or TParenExpr or TUnresolvedMemberChainResultExpr or
|
||||
TUnsafeExpr;
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
@@ -2570,6 +2575,12 @@ module Synth {
|
||||
*/
|
||||
TUnsafeCastExpr convertUnsafeCastExprFromRaw(Raw::Element e) { result = TUnsafeCastExpr(e) }
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a raw element to a synthesized `TUnsafeExpr`, if possible.
|
||||
*/
|
||||
TUnsafeExpr convertUnsafeExprFromRaw(Raw::Element e) { result = TUnsafeExpr(e) }
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a raw element to a synthesized `TVarargExpansionExpr`, if possible.
|
||||
@@ -3706,6 +3717,8 @@ module Synth {
|
||||
result = convertParenExprFromRaw(e)
|
||||
or
|
||||
result = convertUnresolvedMemberChainResultExprFromRaw(e)
|
||||
or
|
||||
result = convertUnsafeExprFromRaw(e)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5292,6 +5305,12 @@ module Synth {
|
||||
*/
|
||||
Raw::Element convertUnsafeCastExprToRaw(TUnsafeCastExpr e) { e = TUnsafeCastExpr(result) }
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a synthesized `TUnsafeExpr` to a raw DB element, if possible.
|
||||
*/
|
||||
Raw::Element convertUnsafeExprToRaw(TUnsafeExpr e) { e = TUnsafeExpr(result) }
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a synthesized `TVarargExpansionExpr` to a raw DB element, if possible.
|
||||
@@ -6428,6 +6447,8 @@ module Synth {
|
||||
result = convertParenExprToRaw(e)
|
||||
or
|
||||
result = convertUnresolvedMemberChainResultExprToRaw(e)
|
||||
or
|
||||
result = convertUnsafeExprToRaw(e)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -163,6 +163,7 @@ 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.UnsafeExprConstructor
|
||||
import codeql.swift.elements.expr.internal.VarargExpansionExprConstructor
|
||||
import codeql.swift.elements.pattern.internal.AnyPatternConstructor
|
||||
import codeql.swift.elements.pattern.internal.BindingPatternConstructor
|
||||
|
||||
23
swift/ql/lib/codeql/swift/generated/expr/UnsafeExpr.qll
generated
Normal file
23
swift/ql/lib/codeql/swift/generated/expr/UnsafeExpr.qll
generated
Normal file
@@ -0,0 +1,23 @@
|
||||
// generated by codegen/codegen.py, do not edit
|
||||
/**
|
||||
* This module provides the generated definition of `UnsafeExpr`.
|
||||
* INTERNAL: Do not import directly.
|
||||
*/
|
||||
|
||||
private import codeql.swift.generated.Synth
|
||||
private import codeql.swift.generated.Raw
|
||||
import codeql.swift.elements.expr.internal.IdentityExprImpl::Impl as IdentityExprImpl
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the fully generated definition of `UnsafeExpr` and should not
|
||||
* be referenced directly.
|
||||
*/
|
||||
module Generated {
|
||||
/**
|
||||
* INTERNAL: Do not reference the `Generated::UnsafeExpr` class directly.
|
||||
* Use the subclass `UnsafeExpr`, where the following predicates are available.
|
||||
*/
|
||||
class UnsafeExpr extends Synth::TUnsafeExpr, IdentityExprImpl::IdentityExpr {
|
||||
override string getAPrimaryQlClass() { result = "UnsafeExpr" }
|
||||
}
|
||||
}
|
||||
5
swift/ql/lib/swift.dbscheme
generated
5
swift/ql/lib/swift.dbscheme
generated
@@ -1044,6 +1044,7 @@ force_value_exprs( //dir=expr
|
||||
| @dot_self_expr
|
||||
| @paren_expr
|
||||
| @unresolved_member_chain_result_expr
|
||||
| @unsafe_expr
|
||||
;
|
||||
|
||||
#keyset[id]
|
||||
@@ -1693,6 +1694,10 @@ unsafe_cast_exprs( //dir=expr
|
||||
unique int id: @unsafe_cast_expr
|
||||
);
|
||||
|
||||
unsafe_exprs( //dir=expr
|
||||
unique int id: @unsafe_expr
|
||||
);
|
||||
|
||||
boolean_literal_exprs( //dir=expr
|
||||
unique int id: @boolean_literal_expr,
|
||||
boolean value: boolean ref
|
||||
|
||||
@@ -8,6 +8,8 @@ instances
|
||||
| identity_expressions.swift:15:5:15:21 | await ... | AwaitExpr | getSubExpr: | identity_expressions.swift:15:11:15:21 | call to process() |
|
||||
| identity_expressions.swift:15:11:15:19 | (...) | ParenExpr | getSubExpr: | identity_expressions.swift:15:12:15:12 | process() |
|
||||
| identity_expressions.swift:18:9:18:17 | BorrowExpr | BorrowExpr | getSubExpr: | identity_expressions.swift:18:17:18:17 | x |
|
||||
| identity_expressions.swift:23:33:23:40 | UnsafeExpr | UnsafeExpr | getSubExpr: | identity_expressions.swift:23:40:23:40 | y |
|
||||
| identity_expressions.swift:24:13:24:20 | UnsafeExpr | UnsafeExpr | getSubExpr: | identity_expressions.swift:24:20:24:20 | x |
|
||||
getType
|
||||
| identity_expressions.swift:5:9:5:14 | .self | A |
|
||||
| identity_expressions.swift:5:9:5:21 | .self | @lvalue Int |
|
||||
@@ -18,3 +20,5 @@ getType
|
||||
| identity_expressions.swift:15:5:15:21 | await ... | () |
|
||||
| identity_expressions.swift:15:11:15:19 | (...) | () async -> () |
|
||||
| identity_expressions.swift:18:9:18:17 | BorrowExpr | Int |
|
||||
| identity_expressions.swift:23:33:23:40 | UnsafeExpr | UnsafeType |
|
||||
| identity_expressions.swift:24:13:24:20 | UnsafeExpr | UnsafeType |
|
||||
|
||||
@@ -16,3 +16,10 @@ Task.init {
|
||||
}
|
||||
let x = 42
|
||||
let _ = _borrow x
|
||||
|
||||
struct UnsafeType {}
|
||||
|
||||
func unsafeFunc(_ y: UnsafeType) {
|
||||
@unsafe let x: UnsafeType = unsafe y
|
||||
let _ = unsafe x
|
||||
}
|
||||
|
||||
@@ -632,6 +632,9 @@ class AutoClosureExpr(ClosureExpr):
|
||||
class AwaitExpr(IdentityExpr):
|
||||
pass
|
||||
|
||||
class UnsafeExpr(IdentityExpr):
|
||||
pass
|
||||
|
||||
class BinaryExpr(ApplyExpr):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user