mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Swift: extract ExtracFunctionIsolationExpr
This commit is contained in:
@@ -202,7 +202,7 @@ MAP(swift::Expr, ExprTag)
|
||||
MAP(swift::ConsumeExpr, ConsumeExprTag)
|
||||
MAP(swift::MaterializePackExpr, MaterializePackExprTag)
|
||||
MAP(swift::SingleValueStmtExpr, SingleValueStmtExprTag)
|
||||
MAP(swift::ExtractFunctionIsolationExpr, void) // TODO swift 6.0
|
||||
MAP(swift::ExtractFunctionIsolationExpr, ExtractFunctionIsolationExprTag)
|
||||
MAP(swift::CurrentContextIsolationExpr, void) // TODO swift 6.0
|
||||
MAP(swift::Decl, DeclTag)
|
||||
MAP(swift::ValueDecl, ValueDeclTag)
|
||||
|
||||
@@ -671,4 +671,11 @@ codeql::MaterializePackExpr ExprTranslator::translateMaterializePackExpr(
|
||||
return entry;
|
||||
}
|
||||
|
||||
codeql::ExtractFunctionIsolationExpr ExprTranslator::translateExtractFunctionIsolationExpr(
|
||||
const swift::ExtractFunctionIsolationExpr& expr) {
|
||||
auto entry = createExprEntry(expr);
|
||||
entry.function_expr = dispatcher.fetchLabel(expr.getFunctionExpr());
|
||||
return entry;
|
||||
}
|
||||
|
||||
} // namespace codeql
|
||||
|
||||
@@ -125,6 +125,8 @@ class ExprTranslator : public AstTranslatorBase<ExprTranslator> {
|
||||
codeql::CopyExpr translateCopyExpr(const swift::CopyExpr& expr);
|
||||
codeql::ConsumeExpr translateConsumeExpr(const swift::ConsumeExpr& expr);
|
||||
codeql::MaterializePackExpr translateMaterializePackExpr(const swift::MaterializePackExpr& expr);
|
||||
codeql::ExtractFunctionIsolationExpr translateExtractFunctionIsolationExpr(
|
||||
const swift::ExtractFunctionIsolationExpr& expr);
|
||||
|
||||
private:
|
||||
void fillClosureExpr(const swift::AbstractClosureExpr& expr, codeql::ClosureExpr& entry);
|
||||
|
||||
16
swift/ql/.generated.list
generated
16
swift/ql/.generated.list
generated
@@ -164,6 +164,7 @@ lib/codeql/swift/elements/expr/ExistentialMetatypeToObjectExpr.qll d594531b0f9ce
|
||||
lib/codeql/swift/elements/expr/ExplicitCastExpr.qll 2298ed1952b7d6454d6da53f79a5460987fea4c30317187799fd425d0a013e4f bc4007c1521fbaa9811d6a893a2eea9901f3b1bff2e89a201d416c067e5b2e32
|
||||
lib/codeql/swift/elements/expr/ExplicitClosureExpr.qll bdfa54ebd6bf8bb872cad5a04f57a78c63f9a92ab282d845bf654a45da0cad97 1071c526a7d263151ce9de155d43245dddce33d168b6520f49c96908e91fb256
|
||||
lib/codeql/swift/elements/expr/Expr.qll ae02fbaaf676b1418a047da363a4a61174ba5aba08b229b4f6ba5b3fb96c1edd ff9c4d4d274cceeb178d85a469791833b60a89b06dc4df4678932d6ea7a799ee
|
||||
lib/codeql/swift/elements/expr/ExtractFunctionIsolationExpr.qll 3b557d7e0c8d340e30ff22b22a1f7eb5a7ccb3e278835f1968627c5174cb530a dc25ac7455be2c622e588855a572c49b31e3cdf8900fc83ee79ff40a5e1c4687
|
||||
lib/codeql/swift/elements/expr/FloatLiteralExpr.qll f80be9eea21297f891761284da66c690706b188aadf824641a27446c1b914789 5c6a0ea847a688a33acb6e12713b9d9f33218148e6a51e80b57b3e0e4543ffae
|
||||
lib/codeql/swift/elements/expr/ForceTryExpr.qll 087b6e8ee24d6956cd63adf3e82d89e37d0482c7ba19c2b69af557d1962fdd62 233e166748af3d0f1efb265cd6b15c9960df841fabd6a8eb54744b53d897b35f
|
||||
lib/codeql/swift/elements/expr/ForceValueExpr.qll 397cfd523b3791684482c55a130629d10fd3d993ffe21e8e2d6e7b0295881e54 4a3ecd15296c661d9ebcccaa75f742fdb10056614e0f0ac6085571951b580d6a
|
||||
@@ -311,6 +312,8 @@ lib/codeql/swift/elements/expr/internal/ErrorExprImpl.qll 819ddf5500b362c2b48ae9
|
||||
lib/codeql/swift/elements/expr/internal/ExistentialMetatypeToObjectExprConstructor.qll 338043a69b96c85913ac5ae02efb7fa363bb97ef33f1caab4253f1146f4a0e2b 0e66776ca92ebc6ab5b3cbc2b4e7fca382436279dacd5bf9f742b6e0c2150ab0
|
||||
lib/codeql/swift/elements/expr/internal/ExistentialMetatypeToObjectExprImpl.qll 50104bc5721fbd13e1b22639b1a8e1114c0691297c808926c73f5257e55fd4f6 38b634dc13cdbabe0f7195e2a399c7370522b7fc8a56a3a9c53e8928b0742100
|
||||
lib/codeql/swift/elements/expr/internal/ExplicitClosureExprConstructor.qll fe430a5f87fdb10a4354f699437150bda543ae7b2d09879e50c0498239417a4b f8ea635fe9ab01d48a52f135079a34689a648a4c279bddaf8def56ed014868b7
|
||||
lib/codeql/swift/elements/expr/internal/ExtractFunctionIsolationExprConstructor.qll 5f940fa3982695f409225cc81dd89140aa35d396ba93ae88a370167e3e1ebdc2 b6c3085b5d7fed62660b57578537fb9ad7bde1a564b832e1eee7845a813e76be
|
||||
lib/codeql/swift/elements/expr/internal/ExtractFunctionIsolationExprImpl.qll edaad600821c5534b3b2c1a642c9d36b2c1ac406d97334ab7c1e4d934f188614 02e36137fcd5b64d1a89950a01ed129dc28034cf64310d333c06bc581ac9472e
|
||||
lib/codeql/swift/elements/expr/internal/FloatLiteralExprConstructor.qll b6a507af69777dc3e333e1346a3f93b4398551608f6789de562c2b57f1f5bb67 fe2eb2aacb3d4c3d2fa5476199512d5e1ce6aca6d2605dc94445e127ee2f3b08
|
||||
lib/codeql/swift/elements/expr/internal/ForceTryExprConstructor.qll 159e084ab5e6fdbcd45b0ec0d4915121e8f425d764e8787df053e8a0b8fb6137 ebd9c1eb6c5029eef2ee6bb307e15f1eaf2e5db1fa97565cd04386b584b56674
|
||||
lib/codeql/swift/elements/expr/internal/ForceValueExprConstructor.qll 1c85f4d1d06f46f8c992ca13e32de8bc2c682d04a550ccec026ea301307ce2ef a89cf5fdd2063318244d42e73ddbe0e235bd76dcf35e54ace58f098d217e94d7
|
||||
@@ -692,7 +695,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 8a9719dd149f539a01c4c8cbe93a15f221cc1dee388a500adada8facd6a92f57 8a9719dd149f539a01c4c8cbe93a15f221cc1dee388a500adada8facd6a92f57
|
||||
lib/codeql/swift/elements.qll 0853da5629624f0be83b603afa04e2280d4feb65f4c1c764ff21d979342f91d4 0853da5629624f0be83b603afa04e2280d4feb65f4c1c764ff21d979342f91d4
|
||||
lib/codeql/swift/generated/AstNode.qll 6fb80e9b230a1e3ae8193af40744f253d5cc81dc4239156924e5ab606c491efc e5c28418e9a38bde08f323a3986a199620189fc4a8a4dc8f670610a5d3d65b99
|
||||
lib/codeql/swift/generated/AvailabilityInfo.qll e3a5274c43e72ff124b6988fd8be0c83a41b89337e11104150dd0ca7f51d8a11 889563791ca8d9758dbbccf64a0731c4bdbf721cad32bc6cd723f1072b6aa1de
|
||||
lib/codeql/swift/generated/AvailabilitySpec.qll bc64d5c690c4d18800f0a48cc76a6a9ee4f832041343666da2d8df2aae04ed7e d03bf874293ac0ab09c025f75c0f392473d47bebe3223143adcc13882a366119
|
||||
@@ -709,12 +712,12 @@ 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 bafa2e366c0df25d6c26c4e2e2b84f3e363524d7abcf0f6e31e42879f2bc664a 616160f5664f77346992c2ac39e3229abdf186fe707066d4895ceddd148749a9
|
||||
lib/codeql/swift/generated/ParentChild.qll b83a0abc72324c099409e5136f50b9da12cbc27129b7679cc66138d796eddcf7 28cef184087887409504bcab8a7b381982fdafbc4b12e7b90236620b83693dc9
|
||||
lib/codeql/swift/generated/PlatformVersionAvailabilitySpec.qll dc17b49a90a18a8f7607adf2433bc8f0c194fa3e803aa3822f809d4d4fbd6793 be48ea9f8ae17354c8508aaed24337a9e57ce01f288fece3dcecd99776cabcec
|
||||
lib/codeql/swift/generated/PureSynthConstructors.qll bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4 bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4
|
||||
lib/codeql/swift/generated/Raw.qll 4f2ddadd2ced9728aaf4595ccf85cd147468d7ad0a57a21a6cbfd04e3834b386 9653595693da55953d7743fbecce33d16910e3b6737c654311f1e34d27ad7f0b
|
||||
lib/codeql/swift/generated/Synth.qll 31e318c6e156848c85a2a2664695b48b5e93c57c9bb22fa29d027069907b3ab0 8655ffcf772f55284b93f1d7f8e1b3d497a9744d5f2e0c17bc322c1fdf8bdba8
|
||||
lib/codeql/swift/generated/SynthConstructors.qll 3e53c7853096020219c01dae85681fe80b34938d198a0ff359a209dda41c5ed7 3e53c7853096020219c01dae85681fe80b34938d198a0ff359a209dda41c5ed7
|
||||
lib/codeql/swift/generated/Raw.qll 6718c8cfed48ea863eea4e112502de92dc369139a9496c61124ac608ac25f8ac 03a7ee490b51fe328eca447a5042ba6ade0c468faf10971a5793b530b5619953
|
||||
lib/codeql/swift/generated/Synth.qll faa969292c3db59606356e0343ce36c99f53d545bbbe33103ce1de0b8d532d1f 29850fc05a0c8ba89391ec9469b4e75e2a98d523e0d53b0426ef46cb942c02ae
|
||||
lib/codeql/swift/generated/SynthConstructors.qll 73ed3d8d2b059c705c6887a373fb40ce2d66d176dde4d573f099d7e5dbcf4f74 73ed3d8d2b059c705c6887a373fb40ce2d66d176dde4d573f099d7e5dbcf4f74
|
||||
lib/codeql/swift/generated/UnknownFile.qll 247ddf2ebb49ce5ed4bf7bf91a969ddff37de6c78d43d8affccaf7eb586e06f2 452b29f0465ef45e978ef8b647b75e5a2a1e53f2a568fc003bc8f52f73b3fa4d
|
||||
lib/codeql/swift/generated/UnknownLocation.qll d871000b4f53ffca4f67ea23ca5626e5dcce125d62a4d4b9969e08cc974af6fc b05971d7774e60790362fb810fb7086314f40a2de747b8cb1bc823ec6494a4dd
|
||||
lib/codeql/swift/generated/UnspecifiedElement.qll d9ad4ba1ffff90cc465e8ba0dea8c4e8ba67dce5529b53b63ab6dc8e13c85e67 025218e1fee8ee382b63ad38009dfec73dc604d2ba80b9ad956c7c96eeed7022
|
||||
@@ -816,6 +819,7 @@ lib/codeql/swift/generated/expr/ExistentialMetatypeToObjectExpr.qll f6eb63b5887d
|
||||
lib/codeql/swift/generated/expr/ExplicitCastExpr.qll 2830522bd17122c26a2392405b2c160ff29ebe8cb0aa8d21498a2b0f05ce9858 bc96f19c0bcb36e78c7f7c48c7d01dbdefaa20564a020e7baf2fc9d8abe734c2
|
||||
lib/codeql/swift/generated/expr/ExplicitClosureExpr.qll e6fa08fad995b2cafb9d76482cc836e6a0fa24d1e055e848bf2df5acedd12a94 79730347c91ab01c480116c7feba97dafafc030c910e6664519fbc122201cf5b
|
||||
lib/codeql/swift/generated/expr/Expr.qll 29581d27469f6abd06bb1c29cce142e8287f3a6eb7cb251fd14e832e6a6a4e6a 957d3f470d91e757b2921af49651b7c1a1eb111e74ff9ea12577d5df38714c64
|
||||
lib/codeql/swift/generated/expr/ExtractFunctionIsolationExpr.qll 87e5b3d76a64297787c4e9c63e5278f75f94df64acf6dce2cd12af52f071b90b 185ff557ef4f3efaccc696705282df74dda577063197cc8bc20bc8968993a1ff
|
||||
lib/codeql/swift/generated/expr/FloatLiteralExpr.qll fb226de33de8ede0c3048aa5735f83feafa912d165a793e06e50d0d87165989c 0fb88029e576f444a9623b49294a5fb713bb0f38850e136378107dafcefb98a2
|
||||
lib/codeql/swift/generated/expr/ForceTryExpr.qll da482d8440c5245dd4ea347e0d6c14cfb455f426055bb4e4c23cacae511a3a52 9c2ec46370708434337802dc62a07f24382cb3ea4499eafcf45ba8b503cbebf9
|
||||
lib/codeql/swift/generated/expr/ForceValueExpr.qll 3660da045afe79bf7815519134278851a8852ca4a159cf54a2d4f2d413864471 4e7416dc69fb917f6cd304d992a6d0e4e7cd1b4ce16201c86cf3a53a58892635
|
||||
@@ -1144,6 +1148,8 @@ test/extractor-tests/generated/expr/DynamicTypeExpr/MISSING_SOURCE.txt 35fb32ea5
|
||||
test/extractor-tests/generated/expr/EnumIsCaseExpr/EnumIsCaseExpr.ql 426837e6acd80fd5c4f79f756919c99df132f6666aae9d07274c4b95711123bd 451393b79359a46070db84d8d35ad3c7f14cc20eddd3df2a70126575d2200297
|
||||
test/extractor-tests/generated/expr/EnumIsCaseExpr/EnumIsCaseExpr_getType.ql 9deff1a2a2271c2dbe44b2aeef42f9adadd73b0e09eb6d71c68ac5bd8d315447 bdc07aec1fa2ced3f8b4c2dcede0354b8943488acf13e559f882f01161172318
|
||||
test/extractor-tests/generated/expr/ExplicitClosureExpr/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
|
||||
test/extractor-tests/generated/expr/ExtractFunctionIsolationExpr/ExtractFunctionIsolationExpr.ql 7c4666a86e962726a505e76c57196483c6eb5259463a1cbdb6239f5ccbb33a13 2b5acd61e85a46b1c565104ba6f58b58813ffeba3548dacd776f72db552d5d65
|
||||
test/extractor-tests/generated/expr/ExtractFunctionIsolationExpr/ExtractFunctionIsolationExpr_getType.ql 487c727c721ff925861b265d9a4f78029f04dba3b94e064529d89c7ee55ac343 3bfdadc09b8672b9030f43c2f0cab6395af803e79ddc17089c43c3da93d69979
|
||||
test/extractor-tests/generated/expr/FloatLiteralExpr/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
|
||||
test/extractor-tests/generated/expr/ForceTryExpr/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
|
||||
test/extractor-tests/generated/expr/ForceValueExpr/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
|
||||
|
||||
6
swift/ql/.gitattributes
generated
vendored
6
swift/ql/.gitattributes
generated
vendored
@@ -166,6 +166,7 @@
|
||||
/lib/codeql/swift/elements/expr/ExplicitCastExpr.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/ExplicitClosureExpr.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/Expr.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/ExtractFunctionIsolationExpr.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/FloatLiteralExpr.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/ForceTryExpr.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/ForceValueExpr.qll linguist-generated
|
||||
@@ -313,6 +314,8 @@
|
||||
/lib/codeql/swift/elements/expr/internal/ExistentialMetatypeToObjectExprConstructor.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/internal/ExistentialMetatypeToObjectExprImpl.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/internal/ExplicitClosureExprConstructor.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/internal/ExtractFunctionIsolationExprConstructor.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/internal/ExtractFunctionIsolationExprImpl.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/internal/FloatLiteralExprConstructor.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/internal/ForceTryExprConstructor.qll linguist-generated
|
||||
/lib/codeql/swift/elements/expr/internal/ForceValueExprConstructor.qll linguist-generated
|
||||
@@ -818,6 +821,7 @@
|
||||
/lib/codeql/swift/generated/expr/ExplicitCastExpr.qll linguist-generated
|
||||
/lib/codeql/swift/generated/expr/ExplicitClosureExpr.qll linguist-generated
|
||||
/lib/codeql/swift/generated/expr/Expr.qll linguist-generated
|
||||
/lib/codeql/swift/generated/expr/ExtractFunctionIsolationExpr.qll linguist-generated
|
||||
/lib/codeql/swift/generated/expr/FloatLiteralExpr.qll linguist-generated
|
||||
/lib/codeql/swift/generated/expr/ForceTryExpr.qll linguist-generated
|
||||
/lib/codeql/swift/generated/expr/ForceValueExpr.qll linguist-generated
|
||||
@@ -1146,6 +1150,8 @@
|
||||
/test/extractor-tests/generated/expr/EnumIsCaseExpr/EnumIsCaseExpr.ql linguist-generated
|
||||
/test/extractor-tests/generated/expr/EnumIsCaseExpr/EnumIsCaseExpr_getType.ql linguist-generated
|
||||
/test/extractor-tests/generated/expr/ExplicitClosureExpr/MISSING_SOURCE.txt linguist-generated
|
||||
/test/extractor-tests/generated/expr/ExtractFunctionIsolationExpr/ExtractFunctionIsolationExpr.ql linguist-generated
|
||||
/test/extractor-tests/generated/expr/ExtractFunctionIsolationExpr/ExtractFunctionIsolationExpr_getType.ql linguist-generated
|
||||
/test/extractor-tests/generated/expr/FloatLiteralExpr/MISSING_SOURCE.txt linguist-generated
|
||||
/test/extractor-tests/generated/expr/ForceTryExpr/MISSING_SOURCE.txt linguist-generated
|
||||
/test/extractor-tests/generated/expr/ForceValueExpr/MISSING_SOURCE.txt linguist-generated
|
||||
|
||||
1
swift/ql/lib/codeql/swift/elements.qll
generated
1
swift/ql/lib/codeql/swift/elements.qll
generated
@@ -119,6 +119,7 @@ import codeql.swift.elements.expr.ExistentialMetatypeToObjectExpr
|
||||
import codeql.swift.elements.expr.ExplicitCastExpr
|
||||
import codeql.swift.elements.expr.ExplicitClosureExpr
|
||||
import codeql.swift.elements.expr.Expr
|
||||
import codeql.swift.elements.expr.ExtractFunctionIsolationExpr
|
||||
import codeql.swift.elements.expr.FloatLiteralExpr
|
||||
import codeql.swift.elements.expr.ForceTryExpr
|
||||
import codeql.swift.elements.expr.ForceValueExpr
|
||||
|
||||
20
swift/ql/lib/codeql/swift/elements/expr/ExtractFunctionIsolationExpr.qll
generated
Normal file
20
swift/ql/lib/codeql/swift/elements/expr/ExtractFunctionIsolationExpr.qll
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
// generated by codegen/codegen.py, do not edit
|
||||
/**
|
||||
* This module provides the public class `ExtractFunctionIsolationExpr`.
|
||||
*/
|
||||
|
||||
private import internal.ExtractFunctionIsolationExprImpl
|
||||
import codeql.swift.elements.expr.Expr
|
||||
|
||||
/**
|
||||
* An expression that extracts the function isolation of an expression with `@isolated(any)`
|
||||
* function type.
|
||||
*
|
||||
* For example:
|
||||
* ```
|
||||
* func foo(x: @isolated(any) () -> ()) {
|
||||
* let isolation = x.isolation
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
final class ExtractFunctionIsolationExpr = Impl::ExtractFunctionIsolationExpr;
|
||||
14
swift/ql/lib/codeql/swift/elements/expr/internal/ExtractFunctionIsolationExprConstructor.qll
generated
Normal file
14
swift/ql/lib/codeql/swift/elements/expr/internal/ExtractFunctionIsolationExprConstructor.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
|
||||
* `ExtractFunctionIsolationExpr` synthesized instances.
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
|
||||
private import codeql.swift.generated.Raw
|
||||
|
||||
/**
|
||||
* The characteristic predicate of `ExtractFunctionIsolationExpr` synthesized instances.
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
predicate constructExtractFunctionIsolationExpr(Raw::ExtractFunctionIsolationExpr id) { any() }
|
||||
27
swift/ql/lib/codeql/swift/elements/expr/internal/ExtractFunctionIsolationExprImpl.qll
generated
Normal file
27
swift/ql/lib/codeql/swift/elements/expr/internal/ExtractFunctionIsolationExprImpl.qll
generated
Normal file
@@ -0,0 +1,27 @@
|
||||
// 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 `ExtractFunctionIsolationExpr`.
|
||||
*
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
|
||||
private import codeql.swift.generated.expr.ExtractFunctionIsolationExpr
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the customizable definition of `ExtractFunctionIsolationExpr` and should not
|
||||
* be referenced directly.
|
||||
*/
|
||||
module Impl {
|
||||
/**
|
||||
* An expression that extracts the function isolation of an expression with `@isolated(any)`
|
||||
* function type.
|
||||
*
|
||||
* For example:
|
||||
* ```
|
||||
* func foo(x: @isolated(any) () -> ()) {
|
||||
* let isolation = x.isolation
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class ExtractFunctionIsolationExpr extends Generated::ExtractFunctionIsolationExpr { }
|
||||
}
|
||||
22
swift/ql/lib/codeql/swift/generated/ParentChild.qll
generated
22
swift/ql/lib/codeql/swift/generated/ParentChild.qll
generated
@@ -1406,6 +1406,26 @@ private module Impl {
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfExtractFunctionIsolationExpr(
|
||||
ExtractFunctionIsolationExpr e, int index, string partialPredicateCall
|
||||
) {
|
||||
exists(int b, int bExpr, int n, int nFunctionExpr |
|
||||
b = 0 and
|
||||
bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and
|
||||
n = bExpr and
|
||||
nFunctionExpr = n + 1 and
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfExpr(e, index - b, partialPredicateCall)
|
||||
or
|
||||
index = n and
|
||||
result = e.getImmediateFunctionExpr() and
|
||||
partialPredicateCall = "FunctionExpr()"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfForceValueExpr(
|
||||
ForceValueExpr e, int index, string partialPredicateCall
|
||||
) {
|
||||
@@ -5238,6 +5258,8 @@ private module Impl {
|
||||
or
|
||||
result = getImmediateChildOfErrorExpr(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfExtractFunctionIsolationExpr(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfForceValueExpr(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfIfExpr(e, index, partialAccessor)
|
||||
|
||||
21
swift/ql/lib/codeql/swift/generated/Raw.qll
generated
21
swift/ql/lib/codeql/swift/generated/Raw.qll
generated
@@ -1346,6 +1346,27 @@ module Raw {
|
||||
Expr getSubExpr() { explicit_cast_exprs(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* An expression that extracts the function isolation of an expression with `@isolated(any)`
|
||||
* function type.
|
||||
*
|
||||
* For example:
|
||||
* ```
|
||||
* func foo(x: @isolated(any) () -> ()) {
|
||||
* let isolation = x.isolation
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class ExtractFunctionIsolationExpr extends @extract_function_isolation_expr, Expr {
|
||||
override string toString() { result = "ExtractFunctionIsolationExpr" }
|
||||
|
||||
/**
|
||||
* Gets the function expression of this extract function isolation expression.
|
||||
*/
|
||||
Expr getFunctionExpr() { extract_function_isolation_exprs(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
|
||||
32
swift/ql/lib/codeql/swift/generated/Synth.qll
generated
32
swift/ql/lib/codeql/swift/generated/Synth.qll
generated
@@ -394,6 +394,12 @@ module Synth {
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
TExplicitClosureExpr(Raw::ExplicitClosureExpr id) { constructExplicitClosureExpr(id) } or
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
TExtractFunctionIsolationExpr(Raw::ExtractFunctionIsolationExpr id) {
|
||||
constructExtractFunctionIsolationExpr(id)
|
||||
} or
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
@@ -1232,9 +1238,9 @@ module Synth {
|
||||
TCaptureListExpr or TClosureExpr or TCollectionExpr or TConsumeExpr or TCopyExpr or
|
||||
TDeclRefExpr or TDefaultArgumentExpr or TDiscardAssignmentExpr or
|
||||
TDotSyntaxBaseIgnoredExpr or TDynamicTypeExpr or TEnumIsCaseExpr or TErrorExpr or
|
||||
TExplicitCastExpr or TForceValueExpr or TIdentityExpr or TIfExpr or
|
||||
TImplicitConversionExpr or TInOutExpr or TKeyPathApplicationExpr or TKeyPathDotExpr or
|
||||
TKeyPathExpr or TLazyInitializationExpr or TLiteralExpr or TLookupExpr or
|
||||
TExplicitCastExpr or TExtractFunctionIsolationExpr or TForceValueExpr or TIdentityExpr or
|
||||
TIfExpr or TImplicitConversionExpr or TInOutExpr or TKeyPathApplicationExpr or
|
||||
TKeyPathDotExpr or TKeyPathExpr or TLazyInitializationExpr or TLiteralExpr or TLookupExpr or
|
||||
TMakeTemporarilyEscapableExpr or TMaterializePackExpr or TObjCSelectorExpr or TOneWayExpr or
|
||||
TOpaqueValueExpr or TOpenExistentialExpr or TOptionalEvaluationExpr or
|
||||
TOtherInitializerRefExpr or TOverloadedDeclRefExpr or TPackElementExpr or
|
||||
@@ -2018,6 +2024,14 @@ module Synth {
|
||||
result = TExplicitClosureExpr(e)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a raw element to a synthesized `TExtractFunctionIsolationExpr`, if possible.
|
||||
*/
|
||||
TExtractFunctionIsolationExpr convertExtractFunctionIsolationExprFromRaw(Raw::Element e) {
|
||||
result = TExtractFunctionIsolationExpr(e)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a raw element to a synthesized `TFloatLiteralExpr`, if possible.
|
||||
@@ -3545,6 +3559,8 @@ module Synth {
|
||||
or
|
||||
result = convertExplicitCastExprFromRaw(e)
|
||||
or
|
||||
result = convertExtractFunctionIsolationExprFromRaw(e)
|
||||
or
|
||||
result = convertForceValueExprFromRaw(e)
|
||||
or
|
||||
result = convertIdentityExprFromRaw(e)
|
||||
@@ -4690,6 +4706,14 @@ module Synth {
|
||||
e = TExplicitClosureExpr(result)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a synthesized `TExtractFunctionIsolationExpr` to a raw DB element, if possible.
|
||||
*/
|
||||
Raw::Element convertExtractFunctionIsolationExprToRaw(TExtractFunctionIsolationExpr e) {
|
||||
e = TExtractFunctionIsolationExpr(result)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a synthesized `TFloatLiteralExpr` to a raw DB element, if possible.
|
||||
@@ -6215,6 +6239,8 @@ module Synth {
|
||||
or
|
||||
result = convertExplicitCastExprToRaw(e)
|
||||
or
|
||||
result = convertExtractFunctionIsolationExprToRaw(e)
|
||||
or
|
||||
result = convertForceValueExprToRaw(e)
|
||||
or
|
||||
result = convertIdentityExprToRaw(e)
|
||||
|
||||
@@ -90,6 +90,7 @@ import codeql.swift.elements.expr.internal.ErasureExprConstructor
|
||||
import codeql.swift.elements.expr.internal.ErrorExprConstructor
|
||||
import codeql.swift.elements.expr.internal.ExistentialMetatypeToObjectExprConstructor
|
||||
import codeql.swift.elements.expr.internal.ExplicitClosureExprConstructor
|
||||
import codeql.swift.elements.expr.internal.ExtractFunctionIsolationExprConstructor
|
||||
import codeql.swift.elements.expr.internal.FloatLiteralExprConstructor
|
||||
import codeql.swift.elements.expr.internal.ForceTryExprConstructor
|
||||
import codeql.swift.elements.expr.internal.ForceValueExprConstructor
|
||||
|
||||
56
swift/ql/lib/codeql/swift/generated/expr/ExtractFunctionIsolationExpr.qll
generated
Normal file
56
swift/ql/lib/codeql/swift/generated/expr/ExtractFunctionIsolationExpr.qll
generated
Normal file
@@ -0,0 +1,56 @@
|
||||
// generated by codegen/codegen.py, do not edit
|
||||
/**
|
||||
* This module provides the generated definition of `ExtractFunctionIsolationExpr`.
|
||||
* INTERNAL: Do not import directly.
|
||||
*/
|
||||
|
||||
private import codeql.swift.generated.Synth
|
||||
private import codeql.swift.generated.Raw
|
||||
import codeql.swift.elements.expr.Expr
|
||||
import codeql.swift.elements.expr.internal.ExprImpl::Impl as ExprImpl
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the fully generated definition of `ExtractFunctionIsolationExpr` and should not
|
||||
* be referenced directly.
|
||||
*/
|
||||
module Generated {
|
||||
/**
|
||||
* An expression that extracts the function isolation of an expression with `@isolated(any)`
|
||||
* function type.
|
||||
*
|
||||
* For example:
|
||||
* ```
|
||||
* func foo(x: @isolated(any) () -> ()) {
|
||||
* let isolation = x.isolation
|
||||
* }
|
||||
* ```
|
||||
* INTERNAL: Do not reference the `Generated::ExtractFunctionIsolationExpr` class directly.
|
||||
* Use the subclass `ExtractFunctionIsolationExpr`, where the following predicates are available.
|
||||
*/
|
||||
class ExtractFunctionIsolationExpr extends Synth::TExtractFunctionIsolationExpr, ExprImpl::Expr {
|
||||
override string getAPrimaryQlClass() { result = "ExtractFunctionIsolationExpr" }
|
||||
|
||||
/**
|
||||
* Gets the function expression of this extract function isolation expression.
|
||||
*
|
||||
* This includes nodes from the "hidden" AST. It can be overridden in subclasses to change the
|
||||
* behavior of both the `Immediate` and non-`Immediate` versions.
|
||||
*/
|
||||
Expr getImmediateFunctionExpr() {
|
||||
result =
|
||||
Synth::convertExprFromRaw(Synth::convertExtractFunctionIsolationExprToRaw(this)
|
||||
.(Raw::ExtractFunctionIsolationExpr)
|
||||
.getFunctionExpr())
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the function expression of this extract function isolation expression.
|
||||
*/
|
||||
final Expr getFunctionExpr() {
|
||||
exists(Expr immediate |
|
||||
immediate = this.getImmediateFunctionExpr() and
|
||||
if exists(this.getResolveStep()) then result = immediate else result = immediate.resolve()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
6
swift/ql/lib/swift.dbscheme
generated
6
swift/ql/lib/swift.dbscheme
generated
@@ -786,6 +786,7 @@ arguments( //dir=expr
|
||||
| @enum_is_case_expr
|
||||
| @error_expr
|
||||
| @explicit_cast_expr
|
||||
| @extract_function_isolation_expr
|
||||
| @force_value_expr
|
||||
| @identity_expr
|
||||
| @if_expr
|
||||
@@ -994,6 +995,11 @@ explicit_cast_exprs( //dir=expr
|
||||
int sub_expr: @expr_or_none ref
|
||||
);
|
||||
|
||||
extract_function_isolation_exprs( //dir=expr
|
||||
unique int id: @extract_function_isolation_expr,
|
||||
int function_expr: @expr_or_none ref
|
||||
);
|
||||
|
||||
force_value_exprs( //dir=expr
|
||||
unique int id: @force_value_expr,
|
||||
int sub_expr: @expr_or_none ref
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
| extract_function_isolation.swift:2:21:2:23 | ExtractFunctionIsolationExpr | hasType: | yes | getFunctionExpr: | extract_function_isolation.swift:2:21:2:21 | x |
|
||||
@@ -0,0 +1,11 @@
|
||||
// generated by codegen/codegen.py, do not edit
|
||||
import codeql.swift.elements
|
||||
import TestUtils
|
||||
|
||||
from ExtractFunctionIsolationExpr x, string hasType, Expr getFunctionExpr
|
||||
where
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
(if x.hasType() then hasType = "yes" else hasType = "no") and
|
||||
getFunctionExpr = x.getFunctionExpr()
|
||||
select x, "hasType:", hasType, "getFunctionExpr:", getFunctionExpr
|
||||
@@ -0,0 +1 @@
|
||||
| extract_function_isolation.swift:2:21:2:23 | ExtractFunctionIsolationExpr | (any Actor)? |
|
||||
@@ -0,0 +1,7 @@
|
||||
// generated by codegen/codegen.py, do not edit
|
||||
import codeql.swift.elements
|
||||
import TestUtils
|
||||
|
||||
from ExtractFunctionIsolationExpr x
|
||||
where toBeTested(x) and not x.isUnknown()
|
||||
select x, x.getType()
|
||||
@@ -0,0 +1,3 @@
|
||||
func foo(x: @isolated(any) () -> ()) {
|
||||
let isolation = x.isolation
|
||||
}
|
||||
@@ -1425,3 +1425,18 @@ class DiscardStmt(Stmt):
|
||||
```
|
||||
"""
|
||||
sub_expr: Expr | child
|
||||
|
||||
|
||||
class ExtractFunctionIsolationExpr(Expr):
|
||||
"""
|
||||
An expression that extracts the function isolation of an expression with `@isolated(any)`
|
||||
function type.
|
||||
|
||||
For example:
|
||||
```
|
||||
func foo(x: @isolated(any) () -> ()) {
|
||||
let isolation = x.isolation
|
||||
}
|
||||
```
|
||||
"""
|
||||
function_expr: Expr | child
|
||||
|
||||
Reference in New Issue
Block a user