Swift: extract CurrentContextIsolationExpr

This commit is contained in:
Paolo Tranquilli
2025-04-14 09:48:05 +02:00
parent 42ec6b018d
commit 712142cde9
16 changed files with 207 additions and 15 deletions

View File

@@ -203,7 +203,7 @@ MAP(swift::Expr, ExprTag)
MAP(swift::MaterializePackExpr, MaterializePackExprTag)
MAP(swift::SingleValueStmtExpr, SingleValueStmtExprTag)
MAP(swift::ExtractFunctionIsolationExpr, ExtractFunctionIsolationExprTag)
MAP(swift::CurrentContextIsolationExpr, void) // TODO swift 6.0
MAP(swift::CurrentContextIsolationExpr, CurrentContextIsolationExprTag)
MAP(swift::Decl, DeclTag)
MAP(swift::ValueDecl, ValueDeclTag)
MAP(swift::TypeDecl, TypeDeclTag)

View File

@@ -678,4 +678,11 @@ codeql::ExtractFunctionIsolationExpr ExprTranslator::translateExtractFunctionIso
return entry;
}
codeql::CurrentContextIsolationExpr ExprTranslator::translateCurrentContextIsolationExpr(
const swift::CurrentContextIsolationExpr& expr) {
auto entry = createExprEntry(expr);
entry.actor = dispatcher.fetchLabel(expr.getActor());
return entry;
}
} // namespace codeql

View File

@@ -127,6 +127,8 @@ class ExprTranslator : public AstTranslatorBase<ExprTranslator> {
codeql::MaterializePackExpr translateMaterializePackExpr(const swift::MaterializePackExpr& expr);
codeql::ExtractFunctionIsolationExpr translateExtractFunctionIsolationExpr(
const swift::ExtractFunctionIsolationExpr& expr);
codeql::CurrentContextIsolationExpr translateCurrentContextIsolationExpr(
const swift::CurrentContextIsolationExpr& expr);
private:
void fillClosureExpr(const swift::AbstractClosureExpr& expr, codeql::ClosureExpr& entry);

View File

@@ -143,6 +143,7 @@ lib/codeql/swift/elements/expr/ConsumeExpr.qll cf1551b82e4dd28555778f4092a90f917
lib/codeql/swift/elements/expr/CopyExpr.qll ff680438de3b2105d4fd69f48879eaa954436e63809b045f766d50454436f88a 1e0781d35da6d31bdd66110e3ce4d5dce46cf7b9e4b285ed5f544c8d40945639
lib/codeql/swift/elements/expr/CovariantFunctionConversionExpr.qll 4acc70bae3a6d31798a505be6604e1bee00770b7d385ea44550d4c0e5db35477 d6f852d2d11a78ea7c188379ad474db8d77494e3a3621dca1b7d963e083374d3
lib/codeql/swift/elements/expr/CovariantReturnConversionExpr.qll d6856a3986eb1421c0676d046432657a52e4c77775fd7c437090cfa8ade3ee29 b8229608a404e5f310a329568a26994eca0361f0653aefdb495351fbefaa5a97
lib/codeql/swift/elements/expr/CurrentContextIsolationExpr.qll 1500722bc7ae42c524d1b1cf578befcea69bea5c7a24280af07c911dbdb31e8c 567366f4d3642e183dff1d8bfad3bea433fd6ea37b841faaaa25c21ca0654289
lib/codeql/swift/elements/expr/DeclRefExpr.qll 4d7eb8f70aa18d35cde805a310b836d702c8c9da55e9676f8db3338dc57e8034 c6136ccf37e8128640d9df423713b7646309e51c3eda5c6d2807fdb0cc0733e2
lib/codeql/swift/elements/expr/DefaultArgumentExpr.qll d655cc4c69db37dc20c477e72df9bb53e18dcc65ffefe61a1bca1854bc006210 a8af422bfdcf56ac37a322d707252ed34b08acf58608065ff3bd214137583b13
lib/codeql/swift/elements/expr/DerivedToBaseExpr.qll d42b72fe5c4a36830c9c7b6c929992fb18dabeedda448159822770256593f274 fc6240a71dbd554f8bcc86c2ad0b05f2112578223e9a180beeb0223bf9cc76be
@@ -285,6 +286,8 @@ lib/codeql/swift/elements/expr/internal/CovariantFunctionConversionExprConstruct
lib/codeql/swift/elements/expr/internal/CovariantFunctionConversionExprImpl.qll 499b77c2820d42739843665a7574e47e630d3afd125cb4cbb4952d7fe6fde867 fe7d197f25786e329235756a85a90faec82273e097896224bd64f8fb4a804bd9
lib/codeql/swift/elements/expr/internal/CovariantReturnConversionExprConstructor.qll 5328580363441c1d76c8ba2654448207f581bc9af4b612b78c2522dceb1accea 687f9b1a9c57f0364893df2812472de0d32e5faed37d34ca429fcea2f9fa2857
lib/codeql/swift/elements/expr/internal/CovariantReturnConversionExprImpl.qll 750189e344195f715d09e93e772d5cf3a611a6d1895b7e4a88db4abfe0a5dc8a 8f646de70cb489f46bcc295e4b4a3bd7b8f03e3691c444c1f80b34453b65274c
lib/codeql/swift/elements/expr/internal/CurrentContextIsolationExprConstructor.qll 153c80058a025e57375acb36938a44aa0b959772e2864e83e4fb48e9aacf63d2 bea25c65c5a16be09765ab7fe9db37190c18f778878a16cbec92c47f9d25159d
lib/codeql/swift/elements/expr/internal/CurrentContextIsolationExprImpl.qll 56b1efc50878f99474c7e5dc5525d7ba98f857112b5fe29926feb2f112d4416c efde63d7e72635f8027b04990eb40bf494fc14215e6ab08316c73b6caa0e49fb
lib/codeql/swift/elements/expr/internal/DeclRefExprConstructor.qll 70bd400520a0c5f29494c320184468d36075cf24feb1f6393fc430b47a2cd336 0d3419d85b0a62cc3c8f0f0cb3a4e9a09d250f2e8b99fb11b96e18f584f817a7
lib/codeql/swift/elements/expr/internal/DefaultArgumentExprConstructor.qll 31f4def20cb3b60b48eae9b24022f853dc490c2282368fbd8f89e2c689963f86 45dd0dc08a1c4729178b80c4027ad98cba5258ea31e11f0936a8fa9bde8d3b3b
lib/codeql/swift/elements/expr/internal/DerivedToBaseExprConstructor.qll d258b88fff4f115e9b4c7ef4cb26623787732cf0d7cf9b59da273d8ebcdb9460 a0a3615be242c3b52624423d685bea3b1f57ebedb2dba51059acc33e2da49844
@@ -695,7 +698,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 0853da5629624f0be83b603afa04e2280d4feb65f4c1c764ff21d979342f91d4 0853da5629624f0be83b603afa04e2280d4feb65f4c1c764ff21d979342f91d4
lib/codeql/swift/elements.qll 913ca9d6eda0972ab2e1922c40cc5f3519bcdfc36db70873b4802822852eac44 913ca9d6eda0972ab2e1922c40cc5f3519bcdfc36db70873b4802822852eac44
lib/codeql/swift/generated/AstNode.qll 6fb80e9b230a1e3ae8193af40744f253d5cc81dc4239156924e5ab606c491efc e5c28418e9a38bde08f323a3986a199620189fc4a8a4dc8f670610a5d3d65b99
lib/codeql/swift/generated/AvailabilityInfo.qll e3a5274c43e72ff124b6988fd8be0c83a41b89337e11104150dd0ca7f51d8a11 889563791ca8d9758dbbccf64a0731c4bdbf721cad32bc6cd723f1072b6aa1de
lib/codeql/swift/generated/AvailabilitySpec.qll bc64d5c690c4d18800f0a48cc76a6a9ee4f832041343666da2d8df2aae04ed7e d03bf874293ac0ab09c025f75c0f392473d47bebe3223143adcc13882a366119
@@ -712,12 +715,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 b83a0abc72324c099409e5136f50b9da12cbc27129b7679cc66138d796eddcf7 28cef184087887409504bcab8a7b381982fdafbc4b12e7b90236620b83693dc9
lib/codeql/swift/generated/ParentChild.qll 6208de45f7dbf7713f91c710c6bcca1e14800cb025bdc054ea21df5f23ad9075 c6450faaf5d027fd3f43372588b893855cc72d61eab1a6efa7d9266c00a84aa2
lib/codeql/swift/generated/PlatformVersionAvailabilitySpec.qll dc17b49a90a18a8f7607adf2433bc8f0c194fa3e803aa3822f809d4d4fbd6793 be48ea9f8ae17354c8508aaed24337a9e57ce01f288fece3dcecd99776cabcec
lib/codeql/swift/generated/PureSynthConstructors.qll bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4 bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4
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/Raw.qll 855cacf92f587700c5408b9e17bb360dbcc57656d936148d96a3d4f747593e47 13fde0d5c2644691d6e89f9b62d528a0bdc01c32e1990769c53b65fb4b87526e
lib/codeql/swift/generated/Synth.qll 96e48b93040580edb77d94f1c3b5974899808d507fab2f3c2eab0d50367a3d3f 7e6b50a342e45cb8b3ed53150dbcdb75be07264885fde15d19fd98ae61d1ba05
lib/codeql/swift/generated/SynthConstructors.qll 6367ac382b6516cdf793922702acd6187c7e873eac9f4c215955a67825ab6bf4 6367ac382b6516cdf793922702acd6187c7e873eac9f4c215955a67825ab6bf4
lib/codeql/swift/generated/UnknownFile.qll 247ddf2ebb49ce5ed4bf7bf91a969ddff37de6c78d43d8affccaf7eb586e06f2 452b29f0465ef45e978ef8b647b75e5a2a1e53f2a568fc003bc8f52f73b3fa4d
lib/codeql/swift/generated/UnknownLocation.qll d871000b4f53ffca4f67ea23ca5626e5dcce125d62a4d4b9969e08cc974af6fc b05971d7774e60790362fb810fb7086314f40a2de747b8cb1bc823ec6494a4dd
lib/codeql/swift/generated/UnspecifiedElement.qll d9ad4ba1ffff90cc465e8ba0dea8c4e8ba67dce5529b53b63ab6dc8e13c85e67 025218e1fee8ee382b63ad38009dfec73dc604d2ba80b9ad956c7c96eeed7022
@@ -797,6 +800,7 @@ lib/codeql/swift/generated/expr/ConsumeExpr.qll 86c90b17fb5fded8852088703418132f
lib/codeql/swift/generated/expr/CopyExpr.qll 026c323ebb0ac57814041a73b6c5933501902f744f6d2e971dbc2b39bb987be3 be20d88f5d6f8771a1d0d0af6316ccfd51994dcfaee2a2ee47cb7ef132f8e6b7
lib/codeql/swift/generated/expr/CovariantFunctionConversionExpr.qll 53f906b1ff6c3994829881098d070a92df2ee86242f7636401acfa4c8a0a1e9c 98a5f7949f02f5fc2aee38e2eed2feef677b6f2daa2d244fe790baca347a9db3
lib/codeql/swift/generated/expr/CovariantReturnConversionExpr.qll 68bf0f1a97f6a1bd2a99c60fa09d930cbd427679bbe0f41ae4394b1ad4ba126d c1063eb981345c73b871292218b40308ee5c12babc80b5d63b337eb67628d7a9
lib/codeql/swift/generated/expr/CurrentContextIsolationExpr.qll d5d82951e4aff875c5229daec9f18a3261fb236e326234eadccd7ee5c87a83e0 c76f2fa71e422cbe2dfa39588d1dcaa4e50266fc3102a446fb76386f198601ee
lib/codeql/swift/generated/expr/DeclRefExpr.qll 9a696dc79181a2ebe76e2ad47edc27baac49a9c8ed38e164e5c8c61a81c23865 adcde2929271268d08550848d8c04911aec790af10609e387ea07e80bee0de6f
lib/codeql/swift/generated/expr/DefaultArgumentExpr.qll a9bd89e69f35b04932a89be8099cdb0a4ce65df579d3b88d4cf6f5c328b9f327 16d22db992c2fae4abec569e10be32526883610eea7f90f19c73297168fa63fb
lib/codeql/swift/generated/expr/DerivedToBaseExpr.qll 2b744875e4d12988992222cec5e5c16d65b98dca45a375c436ac5811dff4c19f 536407ce6e380d80bf8fd9d16498a773fba828cf7fa2d43f88a7ec38312f953f

4
swift/ql/.gitattributes generated vendored
View File

@@ -145,6 +145,7 @@
/lib/codeql/swift/elements/expr/CopyExpr.qll linguist-generated
/lib/codeql/swift/elements/expr/CovariantFunctionConversionExpr.qll linguist-generated
/lib/codeql/swift/elements/expr/CovariantReturnConversionExpr.qll linguist-generated
/lib/codeql/swift/elements/expr/CurrentContextIsolationExpr.qll linguist-generated
/lib/codeql/swift/elements/expr/DeclRefExpr.qll linguist-generated
/lib/codeql/swift/elements/expr/DefaultArgumentExpr.qll linguist-generated
/lib/codeql/swift/elements/expr/DerivedToBaseExpr.qll linguist-generated
@@ -287,6 +288,8 @@
/lib/codeql/swift/elements/expr/internal/CovariantFunctionConversionExprImpl.qll linguist-generated
/lib/codeql/swift/elements/expr/internal/CovariantReturnConversionExprConstructor.qll linguist-generated
/lib/codeql/swift/elements/expr/internal/CovariantReturnConversionExprImpl.qll linguist-generated
/lib/codeql/swift/elements/expr/internal/CurrentContextIsolationExprConstructor.qll linguist-generated
/lib/codeql/swift/elements/expr/internal/CurrentContextIsolationExprImpl.qll linguist-generated
/lib/codeql/swift/elements/expr/internal/DeclRefExprConstructor.qll linguist-generated
/lib/codeql/swift/elements/expr/internal/DefaultArgumentExprConstructor.qll linguist-generated
/lib/codeql/swift/elements/expr/internal/DerivedToBaseExprConstructor.qll linguist-generated
@@ -799,6 +802,7 @@
/lib/codeql/swift/generated/expr/CopyExpr.qll linguist-generated
/lib/codeql/swift/generated/expr/CovariantFunctionConversionExpr.qll linguist-generated
/lib/codeql/swift/generated/expr/CovariantReturnConversionExpr.qll linguist-generated
/lib/codeql/swift/generated/expr/CurrentContextIsolationExpr.qll linguist-generated
/lib/codeql/swift/generated/expr/DeclRefExpr.qll linguist-generated
/lib/codeql/swift/generated/expr/DefaultArgumentExpr.qll linguist-generated
/lib/codeql/swift/generated/expr/DerivedToBaseExpr.qll linguist-generated

View File

@@ -98,6 +98,7 @@ import codeql.swift.elements.expr.ConsumeExpr
import codeql.swift.elements.expr.CopyExpr
import codeql.swift.elements.expr.CovariantFunctionConversionExpr
import codeql.swift.elements.expr.CovariantReturnConversionExpr
import codeql.swift.elements.expr.CurrentContextIsolationExpr
import codeql.swift.elements.expr.DeclRefExpr
import codeql.swift.elements.expr.DefaultArgumentExpr
import codeql.swift.elements.expr.DerivedToBaseExpr

View File

@@ -0,0 +1,14 @@
// generated by codegen/codegen.py, do not edit
/**
* This module provides the public class `CurrentContextIsolationExpr`.
*/
private import internal.CurrentContextIsolationExprImpl
import codeql.swift.elements.expr.Expr
/**
* An expression that extracts the actor isolation of the current context, of type `(any Actor)?`.
* This is synthesized by the type checker and does not have any way to be expressed explicitly in
* the source.
*/
final class CurrentContextIsolationExpr = Impl::CurrentContextIsolationExpr;

View 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
* `CurrentContextIsolationExpr` synthesized instances.
* INTERNAL: Do not use.
*/
private import codeql.swift.generated.Raw
/**
* The characteristic predicate of `CurrentContextIsolationExpr` synthesized instances.
* INTERNAL: Do not use.
*/
predicate constructCurrentContextIsolationExpr(Raw::CurrentContextIsolationExpr id) { any() }

View File

@@ -0,0 +1,21 @@
// 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 `CurrentContextIsolationExpr`.
*
* INTERNAL: Do not use.
*/
private import codeql.swift.generated.expr.CurrentContextIsolationExpr
/**
* INTERNAL: This module contains the customizable definition of `CurrentContextIsolationExpr` and should not
* be referenced directly.
*/
module Impl {
/**
* An expression that extracts the actor isolation of the current context, of type `(any Actor)?`.
* This is synthesized by the type checker and does not have any way to be expressed explicitly in
* the source.
*/
class CurrentContextIsolationExpr extends Generated::CurrentContextIsolationExpr { }
}

View File

@@ -1267,6 +1267,21 @@ private module Impl {
)
}
private Element getImmediateChildOfCurrentContextIsolationExpr(
CurrentContextIsolationExpr e, int index, string partialPredicateCall
) {
exists(int b, int bExpr, int n |
b = 0 and
bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and
n = bExpr and
(
none()
or
result = getImmediateChildOfExpr(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfDeclRefExpr(
DeclRefExpr e, int index, string partialPredicateCall
) {
@@ -5244,6 +5259,8 @@ private module Impl {
or
result = getImmediateChildOfCopyExpr(e, index, partialAccessor)
or
result = getImmediateChildOfCurrentContextIsolationExpr(e, index, partialAccessor)
or
result = getImmediateChildOfDeclRefExpr(e, index, partialAccessor)
or
result = getImmediateChildOfDefaultArgumentExpr(e, index, partialAccessor)

View File

@@ -1215,6 +1215,21 @@ module Raw {
Expr getSubExpr() { copy_exprs(this, result) }
}
/**
* INTERNAL: Do not use.
* An expression that extracts the actor isolation of the current context, of type `(any Actor)?`.
* This is synthesized by the type checker and does not have any way to be expressed explicitly in
* the source.
*/
class CurrentContextIsolationExpr extends @current_context_isolation_expr, Expr {
override string toString() { result = "CurrentContextIsolationExpr" }
/**
* Gets the actor of this current context isolation expression.
*/
Expr getActor() { current_context_isolation_exprs(this, result) }
}
/**
* INTERNAL: Do not use.
*/

View File

@@ -310,6 +310,12 @@ module Synth {
TCovariantReturnConversionExpr(Raw::CovariantReturnConversionExpr id) {
constructCovariantReturnConversionExpr(id)
} or
/**
* INTERNAL: Do not use.
*/
TCurrentContextIsolationExpr(Raw::CurrentContextIsolationExpr id) {
constructCurrentContextIsolationExpr(id)
} or
/**
* INTERNAL: Do not use.
*/
@@ -1236,15 +1242,15 @@ module Synth {
class TExpr =
TAnyTryExpr or TAppliedPropertyWrapperExpr or TApplyExpr or TAssignExpr or TBindOptionalExpr or
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 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
TPackExpansionExpr or TPropertyWrapperValuePlaceholderExpr or
TCurrentContextIsolationExpr or TDeclRefExpr or TDefaultArgumentExpr or
TDiscardAssignmentExpr or TDotSyntaxBaseIgnoredExpr or TDynamicTypeExpr or
TEnumIsCaseExpr or TErrorExpr 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 TPackExpansionExpr or TPropertyWrapperValuePlaceholderExpr or
TRebindSelfInInitializerExpr or TSequenceExpr or TSingleValueStmtExpr or TSuperRefExpr or
TTapExpr or TTupleElementExpr or TTupleExpr or TTypeExpr or TUnresolvedDeclRefExpr or
TUnresolvedDotExpr or TUnresolvedMemberExpr or TUnresolvedPatternExpr or
@@ -1884,6 +1890,14 @@ module Synth {
result = TCovariantReturnConversionExpr(e)
}
/**
* INTERNAL: Do not use.
* Converts a raw element to a synthesized `TCurrentContextIsolationExpr`, if possible.
*/
TCurrentContextIsolationExpr convertCurrentContextIsolationExprFromRaw(Raw::Element e) {
result = TCurrentContextIsolationExpr(e)
}
/**
* INTERNAL: Do not use.
* Converts a raw element to a synthesized `TDeclRefExpr`, if possible.
@@ -3543,6 +3557,8 @@ module Synth {
or
result = convertCopyExprFromRaw(e)
or
result = convertCurrentContextIsolationExprFromRaw(e)
or
result = convertDeclRefExprFromRaw(e)
or
result = convertDefaultArgumentExprFromRaw(e)
@@ -4566,6 +4582,14 @@ module Synth {
e = TCovariantReturnConversionExpr(result)
}
/**
* INTERNAL: Do not use.
* Converts a synthesized `TCurrentContextIsolationExpr` to a raw DB element, if possible.
*/
Raw::Element convertCurrentContextIsolationExprToRaw(TCurrentContextIsolationExpr e) {
e = TCurrentContextIsolationExpr(result)
}
/**
* INTERNAL: Do not use.
* Converts a synthesized `TDeclRefExpr` to a raw DB element, if possible.
@@ -6223,6 +6247,8 @@ module Synth {
or
result = convertCopyExprToRaw(e)
or
result = convertCurrentContextIsolationExprToRaw(e)
or
result = convertDeclRefExprToRaw(e)
or
result = convertDefaultArgumentExprToRaw(e)

View File

@@ -71,6 +71,7 @@ import codeql.swift.elements.expr.internal.ConsumeExprConstructor
import codeql.swift.elements.expr.internal.CopyExprConstructor
import codeql.swift.elements.expr.internal.CovariantFunctionConversionExprConstructor
import codeql.swift.elements.expr.internal.CovariantReturnConversionExprConstructor
import codeql.swift.elements.expr.internal.CurrentContextIsolationExprConstructor
import codeql.swift.elements.expr.internal.DeclRefExprConstructor
import codeql.swift.elements.expr.internal.DefaultArgumentExprConstructor
import codeql.swift.elements.expr.internal.DerivedToBaseExprConstructor

View File

@@ -0,0 +1,50 @@
// generated by codegen/codegen.py, do not edit
/**
* This module provides the generated definition of `CurrentContextIsolationExpr`.
* 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 `CurrentContextIsolationExpr` and should not
* be referenced directly.
*/
module Generated {
/**
* An expression that extracts the actor isolation of the current context, of type `(any Actor)?`.
* This is synthesized by the type checker and does not have any way to be expressed explicitly in
* the source.
* INTERNAL: Do not reference the `Generated::CurrentContextIsolationExpr` class directly.
* Use the subclass `CurrentContextIsolationExpr`, where the following predicates are available.
*/
class CurrentContextIsolationExpr extends Synth::TCurrentContextIsolationExpr, ExprImpl::Expr {
override string getAPrimaryQlClass() { result = "CurrentContextIsolationExpr" }
/**
* Gets the actor of this current context 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 getImmediateActor() {
result =
Synth::convertExprFromRaw(Synth::convertCurrentContextIsolationExprToRaw(this)
.(Raw::CurrentContextIsolationExpr)
.getActor())
}
/**
* Gets the actor of this current context isolation expression.
*/
final Expr getActor() {
exists(Expr immediate |
immediate = this.getImmediateActor() and
if exists(this.getResolveStep()) then result = immediate else result = immediate.resolve()
)
}
}
}

View File

@@ -778,6 +778,7 @@ arguments( //dir=expr
| @collection_expr
| @consume_expr
| @copy_expr
| @current_context_isolation_expr
| @decl_ref_expr
| @default_argument_expr
| @discard_assignment_expr
@@ -915,6 +916,11 @@ copy_exprs( //dir=expr
int sub_expr: @expr_or_none ref
);
current_context_isolation_exprs( //dir=expr
unique int id: @current_context_isolation_expr,
int actor: @expr_or_none ref
);
decl_ref_exprs( //dir=expr
unique int id: @decl_ref_expr,
int decl: @decl_or_none ref

View File

@@ -1440,3 +1440,13 @@ class ExtractFunctionIsolationExpr(Expr):
```
"""
function_expr: Expr | child
@qltest.skip
class CurrentContextIsolationExpr(Expr):
"""
An expression that extracts the actor isolation of the current context, of type `(any Actor)?`.
This is synthesized by the type checker and does not have any way to be expressed explicitly in
the source.
"""
actor: Expr