Swift: Support TypeValueExpr and IntegerType

This commit is contained in:
Jeroen Ketema
2025-05-01 15:49:56 +02:00
parent 97d2ed8b3b
commit c74fca929a
32 changed files with 373 additions and 13 deletions

View File

@@ -205,7 +205,7 @@ MAP(swift::Expr, ExprTag)
MAP(swift::SingleValueStmtExpr, SingleValueStmtExprTag)
MAP(swift::ExtractFunctionIsolationExpr, ExtractFunctionIsolationExprTag)
MAP(swift::CurrentContextIsolationExpr, CurrentContextIsolationExprTag)
MAP(swift::TypeValueExpr, void) // TODO swift 6.1
MAP(swift::TypeValueExpr, TypeValueExprTag)
MAP(swift::Decl, DeclTag)
MAP(swift::ValueDecl, ValueDeclTag)
MAP(swift::TypeDecl, TypeDeclTag)
@@ -339,7 +339,7 @@ MAP(swift::TypeBase, TypeTag)
MAP(swift::PackElementType, PackElementTypeTag)
MAP(swift::TypeVariableType, void) // created during type checking and only used for constraint checking
MAP(swift::ErrorUnionType, void) // created during type checking and only used for constraint checking
MAP(swift::IntegerType, void) // TODO swift 6.1
MAP(swift::IntegerType, IntegerTypeTag)
MAP(swift::SugarType, SugarTypeTag)
MAP(swift::TypeAliasType, TypeAliasTypeTag)
MAP(swift::SyntaxSugarType, SyntaxSugarTypeTag)

View File

@@ -285,6 +285,9 @@ SwiftMangledName SwiftMangler::visitGenericTypeParamType(const swift::GenericTyp
if (type->isParameterPack()) {
ret << "each_";
}
if (type->isValue()) {
ret << "val_";
}
if (auto decl = type->getDecl()) {
ret << fetch(decl);
} else {

View File

@@ -689,4 +689,10 @@ codeql::CurrentContextIsolationExpr ExprTranslator::translateCurrentContextIsola
return entry;
}
codeql::TypeValueExpr ExprTranslator::translateTypeValueExpr(const swift::TypeValueExpr& expr) {
auto entry = createExprEntry(expr);
entry.type_repr = dispatcher.fetchLabel(expr.getParamTypeRepr());
return entry;
}
} // namespace codeql

View File

@@ -129,6 +129,7 @@ class ExprTranslator : public AstTranslatorBase<ExprTranslator> {
const swift::ExtractFunctionIsolationExpr& expr);
codeql::CurrentContextIsolationExpr translateCurrentContextIsolationExpr(
const swift::CurrentContextIsolationExpr& expr);
codeql::TypeValueExpr translateTypeValueExpr(const swift::TypeValueExpr& expr);
private:
void fillClosureExpr(const swift::AbstractClosureExpr& expr, codeql::ClosureExpr& entry);

View File

@@ -297,4 +297,10 @@ codeql::PackExpansionType TypeTranslator::translatePackExpansionType(
return entry;
}
codeql::IntegerType TypeTranslator::translateIntegerType(const swift::IntegerType& type) {
auto entry = createTypeEntry(type);
entry.value = type.getDigitsText();
return entry;
}
} // namespace codeql

View File

@@ -82,6 +82,7 @@ class TypeTranslator : public TypeTranslatorBase<TypeTranslator> {
codeql::PackType translatePackType(const swift::PackType& type);
codeql::PackElementType translatePackElementType(const swift::PackElementType& type);
codeql::PackExpansionType translatePackExpansionType(const swift::PackExpansionType& type);
codeql::IntegerType translateIntegerType(const swift::IntegerType& type);
private:
void fillType(const swift::TypeBase& type, codeql::Type& entry);

View File

@@ -230,6 +230,7 @@ lib/codeql/swift/elements/expr/TryExpr.qll 524d52e85f893ed735463f2ac8ebff1c37ce1
lib/codeql/swift/elements/expr/TupleElementExpr.qll 32bd4e870958e0fe8a06626618379d5d081e6b6d1d2da35954ff8c6e1cac5891 1036d0a774f16dfdfe223181bf86a7fb3e5a65495f13a584af4419c769b5ca93
lib/codeql/swift/elements/expr/TupleExpr.qll 11efe0f2737b561a392bbd684c7c1cc2e29bed3273597e64933608d8a4e3a736 f02537adb1271e4b84c44eb001ccb7b7c70f13fc13908354fd4361ed3720d06b
lib/codeql/swift/elements/expr/TypeExpr.qll c3f7272b77aadd8a4a0e5c7e3876bba6bba45343415c8ce96de26e1e898d11c0 91cd440b768e4d9aa60a165ddb62ecdcad85eb4a676ab0d60ca8777e753bffc7
lib/codeql/swift/elements/expr/TypeValueExpr.qll 8a8d061b091594b758fb7d0b708337b639b7d76b1f63bd860e3e4466f268ba3f 7722a6668b3e382e32ef0cc5bbb8c79c7de9a618c8822957e5f48b45770d0af3
lib/codeql/swift/elements/expr/UnderlyingToOpaqueExpr.qll f319daff97d13a5cacf2efcd1f2b77e58ec9b9a30413ddb30cc0333197cbef9f 9c6a97a66a452a6167b26f48b0f31a42e2c528fcd30e76c9f4dd146f6609b5d3
lib/codeql/swift/elements/expr/UnevaluatedInstanceExpr.qll 7eca15f753e81d99a275ca1d29986d5209d8ffea4034746945227fedc1b74c38 714c9a7a09f525187f53a4c9599a141a32ec6071c405c2a425dc2cfb6f2457e6
lib/codeql/swift/elements/expr/UnreachableExpr.qll 930822d66d99422603725161f55fec7b861ef33aa8fe57afbdbea2a68a764fcb e8005f5ac66a97e614f3792e8053b0fb6d6bb1f99bc1d0f7d0d0b41e703efe9c
@@ -408,6 +409,8 @@ lib/codeql/swift/elements/expr/internal/TryExprConstructor.qll 594b8505862487212
lib/codeql/swift/elements/expr/internal/TupleElementExprConstructor.qll e9d0f5b77adcdfad3e4f3aad8674dd86b86d81bc4aca534a6a30172364d5ce81 ccac3b0ae4ebc028a9cb58f6f71a07330fb235180109c1f72ddbb10992af976c
lib/codeql/swift/elements/expr/internal/TupleExprConstructor.qll 14c402dd2c9dc350270d406c8d71b4a46080fd321a60b49e7eb73f46dc371d07 165527b92b2302e098002cf888254a8f4af208cd3aa8f441c740b59ac50ddc15
lib/codeql/swift/elements/expr/internal/TypeExprConstructor.qll 8e23bd56763001fa82b9642c36c54785fd0a544c8eb9175fd12fd5b8053a039c 3388ed62f69e5d45a5d6753400cae3532b1da915186b9bf5d0d29c9cb0e71e8c
lib/codeql/swift/elements/expr/internal/TypeValueExprConstructor.qll dd3b0f5a05a758fce4cdbd4665077b18afd1a76079b5c99ca8be18b1dc2fcced b8b3a648919cbc98b6ad8d973a4e5745cc03026dafeeba2614e6995630e18d6a
lib/codeql/swift/elements/expr/internal/TypeValueExprImpl.qll fe6ba98379db2f664ea34457f8b808881eaf2639b659f1accf52ca2642e5ec02 86df96c256cc924e108241fffe4bd152c61171bc012b13f10d6bbd308df12446
lib/codeql/swift/elements/expr/internal/UnderlyingToOpaqueExprConstructor.qll 8b763964bdda1af1971fa737980780d7a1b57afe37cafc6edc594bedd767725f 0485956adfc2e9a31aeeef1c8ed1d53781967445e3ea0f76c843fd48e33f021a
lib/codeql/swift/elements/expr/internal/UnderlyingToOpaqueExprImpl.qll cf2637b44a96fce2d8e618469692305181490a28f3b2698b6f9db2d58e7c474d 9b062defb7c19e217bea6e5bd65ccf28e1ff25fb1e784405eb92406806a3349c
lib/codeql/swift/elements/expr/internal/UnevaluatedInstanceExprConstructor.qll 4560f4737cb47512b8348fd2a37599227df4a05bfad84873f6666d121a524e0a b49bfdfa550330bab087c5a6b7a3885fd22360e557adf984ce7a35534d882510
@@ -557,6 +560,7 @@ lib/codeql/swift/elements/type/FunctionType.qll 1a64eb24e8baa74ef2a8e4451f97442a
lib/codeql/swift/elements/type/GenericFunctionType.qll 8df1db2785c4e6b88f9af13eb7ba473f91459f57d19c4d706847ac6e3a02d64a 186efec4c23c372f9d9f7038d4b5a36f9c3184564e5b6899d2e467864977dd89
lib/codeql/swift/elements/type/GenericTypeParamType.qll d75c865295501f7efe27399ce93b30f6a4a217ed207e7227a5d9870cf536ad5f 1a764963700b872c8ea7afd586abbc0dadda68366555baefa6737d87b701a73f
lib/codeql/swift/elements/type/InOutType.qll 3ff69b884d2604f66290b188892f1d9d4321bf77a20bcda2ce5cb69e565b0cfb 3cd2b06bc606d84b1d73b8fcd2aea4d49aed0c8b98902b44dd6f19d298db7f9d
lib/codeql/swift/elements/type/IntegerType.qll 118acea4a849506aeddd5df92e9f134bf611f8c08cb44e18dc56259df1c98e5f 6801c067c63e310f28fed70a7c1ed87d08be6b7070a7ec677517a93b6eab0c3f
lib/codeql/swift/elements/type/LValueType.qll e1e53b1467f7b4ff77a812ae9cd8ce151cfc21443a4da14319aee390c081775c 42f5a39fb2c1e5dad3fef6db56430c6063cb04b1ba9c1f2b9c68356aef6aef1c
lib/codeql/swift/elements/type/LocalArchetypeType.qll 449ff6d721a70a0f8f7a8e1604471513af1523bad6efcc49820154e4d42a426b 1121b807f15d442b708bb614b684ad3d0581c787bae4a16999b8dd7da5103ab6
lib/codeql/swift/elements/type/MetatypeType.qll 9a0b15d97d67edfd68221903c65d1537ffd9270630b751528e3c97c504ab9472 aeb2263f4d49f71f529b467f4505605f42be5f48ae52c44b9041eea69fb4e3eb
@@ -655,6 +659,8 @@ lib/codeql/swift/elements/type/internal/GenericTypeParamTypeConstructor.qll b126
lib/codeql/swift/elements/type/internal/GenericTypeParamTypeImpl.qll efca259897a044fc967341a9fdb39497fc5e9bcb0b4ba33fa76cb926b98b3eb7 aaa621c691813a2f70f4071e3592d7760cef319904209770442ca0d0583f65a1
lib/codeql/swift/elements/type/internal/InOutTypeConstructor.qll 40550fd07551bc7c1692e08f1cb0692defca613c3c6403719efc5998eb1f1bfd 775f16224a455e336da239a179f84581b345803b9576aca119aeb3eef583d739
lib/codeql/swift/elements/type/internal/InOutTypeImpl.qll 28fc2931a424f551107b0ee49663d5d5307146c725353c5e484f0dd289f93dc0 ff12e91e30ee53bb8acdcf9e31261b6b1b0ae966babb4eacacb344c22aa1cb6e
lib/codeql/swift/elements/type/internal/IntegerTypeConstructor.qll 39e33225066f7162309f888723f81893703ee0daba68f192e3277f922060160b 08903e4d0bc8889761d016d6b6c4b7f1bd061a08c97e2a151b59cc0400ea2199
lib/codeql/swift/elements/type/internal/IntegerTypeImpl.qll ba8e6e972dcea4dbe937083c819c5fd9eb49ba4b6176e040ce65d36a95fe31bd 88064b52d9430b67edd62ed37426f5adc8f6d80722370340d147b0a4ca90f70c
lib/codeql/swift/elements/type/internal/LValueTypeConstructor.qll e3ab6ebb6191a2553bd4a483067acf7131862bc7235af2da74c35e2250300da8 cfa65d0f22416408ee1e5e5af440166fe5f5b39ae9bf1b9ae92bd9f9f2954b76
lib/codeql/swift/elements/type/internal/LocalArchetypeTypeImpl.qll 8170baafe8e2845a3f7f11894244c6b1cfbeadf7d3c86de676fe17deec68494c e72508db440afe58c2da26529c362f1f7eeb6f360424f62c7f6cd841c4a6f3bd
lib/codeql/swift/elements/type/internal/MetatypeTypeConstructor.qll 7011a1307524477b7e3b43e2efb2ebcbdc7fec258455c95d3c2525cb8857bf3c b56938e2d9cd814b2fa3de569f091f42e716b399e73e024e405eb211f65a944c
@@ -707,7 +713,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 24dc5e00db9aa90fbabc9d2b20b7e3ed9e1cdbc826dbda89f332a83b19054f53 24dc5e00db9aa90fbabc9d2b20b7e3ed9e1cdbc826dbda89f332a83b19054f53
lib/codeql/swift/elements.qll 67832d269392e0c8226bd03918be9b3e4cf11213e54dd3acfe153dd8f8cd33c7 67832d269392e0c8226bd03918be9b3e4cf11213e54dd3acfe153dd8f8cd33c7
lib/codeql/swift/generated/AstNode.qll 6fb80e9b230a1e3ae8193af40744f253d5cc81dc4239156924e5ab606c491efc e5c28418e9a38bde08f323a3986a199620189fc4a8a4dc8f670610a5d3d65b99
lib/codeql/swift/generated/AvailabilityInfo.qll e3a5274c43e72ff124b6988fd8be0c83a41b89337e11104150dd0ca7f51d8a11 889563791ca8d9758dbbccf64a0731c4bdbf721cad32bc6cd723f1072b6aa1de
lib/codeql/swift/generated/AvailabilitySpec.qll bc64d5c690c4d18800f0a48cc76a6a9ee4f832041343666da2d8df2aae04ed7e d03bf874293ac0ab09c025f75c0f392473d47bebe3223143adcc13882a366119
@@ -724,12 +730,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 df9d71a00c137e89dd6a0caab75fea672fdf769ca60975d455aea85f2cb0e911 2a3495960938e3512cc10031b4c70b102c5ef8478528216fa27545b5ad37b9d7
lib/codeql/swift/generated/ParentChild.qll 3b7e2e04c92f395f446fbf2dcf62f97a1b066523a5feb90c1cede9a1e644d4e4 58b8a96626a061b11ea0783b0356467358ef80bc9148666f78d6b64a0457a899
lib/codeql/swift/generated/PlatformVersionAvailabilitySpec.qll dc17b49a90a18a8f7607adf2433bc8f0c194fa3e803aa3822f809d4d4fbd6793 be48ea9f8ae17354c8508aaed24337a9e57ce01f288fece3dcecd99776cabcec
lib/codeql/swift/generated/PureSynthConstructors.qll bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4 bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4
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/Raw.qll ca16e576312f595283994e8b02a32693826712c76c471f7969271dc09361d13e 3d86c741064a075810e1e92d2c3bdc2a77755b9142904dee95709117af3c29a1
lib/codeql/swift/generated/Synth.qll a8462dd9e84e0059f6ca4d9c9f42ac75d0d3fd7b65702e1409c583a89665f18c 051e02492cba3ddda863cd80507a49884d73d57c834f00f6d3547e2143c48dbe
lib/codeql/swift/generated/SynthConstructors.qll 9dc761332663708d16ee6303930557858ea56049ce2dbac4b14f995e6c02977d 9dc761332663708d16ee6303930557858ea56049ce2dbac4b14f995e6c02977d
lib/codeql/swift/generated/UnknownFile.qll 247ddf2ebb49ce5ed4bf7bf91a969ddff37de6c78d43d8affccaf7eb586e06f2 452b29f0465ef45e978ef8b647b75e5a2a1e53f2a568fc003bc8f52f73b3fa4d
lib/codeql/swift/generated/UnknownLocation.qll d871000b4f53ffca4f67ea23ca5626e5dcce125d62a4d4b9969e08cc974af6fc b05971d7774e60790362fb810fb7086314f40a2de747b8cb1bc823ec6494a4dd
lib/codeql/swift/generated/UnspecifiedElement.qll d9ad4ba1ffff90cc465e8ba0dea8c4e8ba67dce5529b53b63ab6dc8e13c85e67 025218e1fee8ee382b63ad38009dfec73dc604d2ba80b9ad956c7c96eeed7022
@@ -899,6 +905,7 @@ lib/codeql/swift/generated/expr/TryExpr.qll 92b670b206df8b75d703c35dec2594802334
lib/codeql/swift/generated/expr/TupleElementExpr.qll 1528226a5615b821fa40127b425a7ffe2004d58b7511ba4e7313449c37e3d552 dcb5bef0a132257c6ca67d2d459ee1e420e0fa36fd8da56aac07af7c27b95a6e
lib/codeql/swift/generated/expr/TupleExpr.qll 860dde65c440ffa74648c663126194182c430c1520d5ce1a6766b81edf16dfd8 669091d441977fb730d3dcbfc6018e5fc013b6c2d27a0877c244431a6ffbb7a8
lib/codeql/swift/generated/expr/TypeExpr.qll 1f38f463b11b9f10878dab7266f05f455a0802e6d7464d81d4c05855d41adc64 b3c3f6b61b466be86a8cc0cea18d85b7a23b1f8dcf876ef2a050ef69778df32b
lib/codeql/swift/generated/expr/TypeValueExpr.qll 7c3ed4ddda248999ebe88c436a1967978efdbde7a4f0b73c1b74d350d59b4d26 e631045cc6943f59ba8732a77fa1ff23f2eddc767722be83160f31a9a65e26bd
lib/codeql/swift/generated/expr/UnderlyingToOpaqueExpr.qll 3d68175d73056e6f5afea5040ad2f9a8447adf078c490bb06769008857ee2ca7 f0ec8f0bf7271289b8be32038e60c2b1053d6563354c8bced53a42fef6292152
lib/codeql/swift/generated/expr/UnevaluatedInstanceExpr.qll bac438970bc12eef2ace318b97d37ef58ab7a9c2c43c3f4515780f65cdc5de70 11810cdd753c744f3ee274fce889d272c3c94b6087c124cdd09e99188eb3f926
lib/codeql/swift/generated/expr/UnreachableExpr.qll ab17ea1f01eb1b22b1012b57582b170936244c98f42374e0e21b9d468db9249c 93a2a3685a9f8d4eab06cf700bc6465915e29b49249a14fe6aa68d1af96c86ca
@@ -986,6 +993,7 @@ lib/codeql/swift/generated/type/FunctionType.qll 739192b77787905a66d9c9970dc077c
lib/codeql/swift/generated/type/GenericFunctionType.qll 50743701a62cad6f2cbe8b331a45bd3b18f3154b860720355b831735fd2208b4 481b28aee3e473a74a66628acd2050cfee9807ebad8c8a0646783e3942b89297
lib/codeql/swift/generated/type/GenericTypeParamType.qll f266dffcd2f87f8411b796b97faa671a7bb5e6dd0aa67d3bfc9bbc06a47f1a3b 0e1625a7d2447faf75ec4c716ed1d5219b82ba8720450bc77d279e9854599758
lib/codeql/swift/generated/type/InOutType.qll 809a3bb1c5eec066416c2fce85df9116e7402a368c7e955abe6a01c7673cbdf4 7c614fa92e624890f3a83e7a7f3464f8a94f45b60beeb77f9295850567522ba7
lib/codeql/swift/generated/type/IntegerType.qll f2040268ae94c41f27a659c09c55360b20000d40440cb9513409a95379b3b37f 4397d31da9bad9e5167d6dc6cb7f26071bb80e00538bd8f55e7fc53e45e8bd32
lib/codeql/swift/generated/type/LValueType.qll 4a6422f21bd21b841d841cad9f7c01ce7eeb9ba6b5d1fa004fa44dc008eaa432 8914e356e0475f0f3b81c681295fa7a833fae2e24c491d8d6e552ad897be4184
lib/codeql/swift/generated/type/LocalArchetypeType.qll de4f291bab61ccb699609f39682cbe29936da3c8be51e9a5620b0bce384bc852 152a74964a40daa7419de15d646ee8b62d137a8a5d7c5d0b002d81d1fdf12c47
lib/codeql/swift/generated/type/MetatypeType.qll bef10ef14aa44b8ef86e5dfe38061df202b9a8d3fb27d671c4b71b51dbe48d1d fd43f29906ef16b3488a74d33fe76ec34e4b8afe6fdfd88036ee1e8305036ca7
@@ -1232,6 +1240,8 @@ test/extractor-tests/generated/expr/TryExpr/MISSING_SOURCE.txt 35fb32ea5393152eb
test/extractor-tests/generated/expr/TupleElementExpr/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
test/extractor-tests/generated/expr/TupleExpr/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
test/extractor-tests/generated/expr/TypeExpr/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
test/extractor-tests/generated/expr/TypeValueExpr/TypeValueExpr.ql 93ebaff4938dd18f3626533cbf23094c4d7eac7ce84325b743f78dd36d8831e5 c3bc6b6f7a18ca5a32084207fac2468f6306b81cd6a7af1ecf117b1a37147266
test/extractor-tests/generated/expr/TypeValueExpr/TypeValueExpr_getType.ql da07880497965cf7f7e28fb3c3a8e8223368685fdacb62d7e562757f01fd521c 9be644216f6adf12adf102ecfac5b3820c2fe7916a86586744ae71d1c11d9704
test/extractor-tests/generated/expr/VarargExpansionExpr/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
test/extractor-tests/generated/pattern/AnyPattern/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
test/extractor-tests/generated/pattern/BindingPattern/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
@@ -1295,6 +1305,7 @@ test/extractor-tests/generated/type/FunctionType/MISSING_SOURCE.txt 35fb32ea5393
test/extractor-tests/generated/type/GenericFunctionType/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
test/extractor-tests/generated/type/GenericTypeParamType/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
test/extractor-tests/generated/type/InOutType/InOutType.ql a3591003defc284ba9c1c8492ccea5f46ff1de2d86a2240da3a501598d236f8e 4915db95b101c199dcf194e8b974a3c7c94f8ac1d4d9dbf6144822beb4ec0b66
test/extractor-tests/generated/type/IntegerType/IntegerType.ql 7c911b67a801d8a4f0fe695c66318f6a08278b632adacb58bb10578474a43d49 9590080054ad1280eecb97d2f5265de8c2d2eeca03af24654cac5e2818240e85
test/extractor-tests/generated/type/LValueType/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
test/extractor-tests/generated/type/MetatypeType/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
test/extractor-tests/generated/type/ModuleType/ModuleType.ql a65f7a166068b3bc622864b4b7464a25e41cd8a02f2bdce214ae59475acb9893 89a165e1c0f5b1de549d6c73e893cbc520832d534f801ba5d9144ac2ae3a9b8a

11
swift/ql/.gitattributes generated vendored
View File

@@ -232,6 +232,7 @@
/lib/codeql/swift/elements/expr/TupleElementExpr.qll linguist-generated
/lib/codeql/swift/elements/expr/TupleExpr.qll linguist-generated
/lib/codeql/swift/elements/expr/TypeExpr.qll linguist-generated
/lib/codeql/swift/elements/expr/TypeValueExpr.qll linguist-generated
/lib/codeql/swift/elements/expr/UnderlyingToOpaqueExpr.qll linguist-generated
/lib/codeql/swift/elements/expr/UnevaluatedInstanceExpr.qll linguist-generated
/lib/codeql/swift/elements/expr/UnreachableExpr.qll linguist-generated
@@ -410,6 +411,8 @@
/lib/codeql/swift/elements/expr/internal/TupleElementExprConstructor.qll linguist-generated
/lib/codeql/swift/elements/expr/internal/TupleExprConstructor.qll linguist-generated
/lib/codeql/swift/elements/expr/internal/TypeExprConstructor.qll linguist-generated
/lib/codeql/swift/elements/expr/internal/TypeValueExprConstructor.qll linguist-generated
/lib/codeql/swift/elements/expr/internal/TypeValueExprImpl.qll linguist-generated
/lib/codeql/swift/elements/expr/internal/UnderlyingToOpaqueExprConstructor.qll linguist-generated
/lib/codeql/swift/elements/expr/internal/UnderlyingToOpaqueExprImpl.qll linguist-generated
/lib/codeql/swift/elements/expr/internal/UnevaluatedInstanceExprConstructor.qll linguist-generated
@@ -559,6 +562,7 @@
/lib/codeql/swift/elements/type/GenericFunctionType.qll linguist-generated
/lib/codeql/swift/elements/type/GenericTypeParamType.qll linguist-generated
/lib/codeql/swift/elements/type/InOutType.qll linguist-generated
/lib/codeql/swift/elements/type/IntegerType.qll linguist-generated
/lib/codeql/swift/elements/type/LValueType.qll linguist-generated
/lib/codeql/swift/elements/type/LocalArchetypeType.qll linguist-generated
/lib/codeql/swift/elements/type/MetatypeType.qll linguist-generated
@@ -657,6 +661,8 @@
/lib/codeql/swift/elements/type/internal/GenericTypeParamTypeImpl.qll linguist-generated
/lib/codeql/swift/elements/type/internal/InOutTypeConstructor.qll linguist-generated
/lib/codeql/swift/elements/type/internal/InOutTypeImpl.qll linguist-generated
/lib/codeql/swift/elements/type/internal/IntegerTypeConstructor.qll linguist-generated
/lib/codeql/swift/elements/type/internal/IntegerTypeImpl.qll linguist-generated
/lib/codeql/swift/elements/type/internal/LValueTypeConstructor.qll linguist-generated
/lib/codeql/swift/elements/type/internal/LocalArchetypeTypeImpl.qll linguist-generated
/lib/codeql/swift/elements/type/internal/MetatypeTypeConstructor.qll linguist-generated
@@ -901,6 +907,7 @@
/lib/codeql/swift/generated/expr/TupleElementExpr.qll linguist-generated
/lib/codeql/swift/generated/expr/TupleExpr.qll linguist-generated
/lib/codeql/swift/generated/expr/TypeExpr.qll linguist-generated
/lib/codeql/swift/generated/expr/TypeValueExpr.qll linguist-generated
/lib/codeql/swift/generated/expr/UnderlyingToOpaqueExpr.qll linguist-generated
/lib/codeql/swift/generated/expr/UnevaluatedInstanceExpr.qll linguist-generated
/lib/codeql/swift/generated/expr/UnreachableExpr.qll linguist-generated
@@ -988,6 +995,7 @@
/lib/codeql/swift/generated/type/GenericFunctionType.qll linguist-generated
/lib/codeql/swift/generated/type/GenericTypeParamType.qll linguist-generated
/lib/codeql/swift/generated/type/InOutType.qll linguist-generated
/lib/codeql/swift/generated/type/IntegerType.qll linguist-generated
/lib/codeql/swift/generated/type/LValueType.qll linguist-generated
/lib/codeql/swift/generated/type/LocalArchetypeType.qll linguist-generated
/lib/codeql/swift/generated/type/MetatypeType.qll linguist-generated
@@ -1234,6 +1242,8 @@
/test/extractor-tests/generated/expr/TupleElementExpr/MISSING_SOURCE.txt linguist-generated
/test/extractor-tests/generated/expr/TupleExpr/MISSING_SOURCE.txt linguist-generated
/test/extractor-tests/generated/expr/TypeExpr/MISSING_SOURCE.txt linguist-generated
/test/extractor-tests/generated/expr/TypeValueExpr/TypeValueExpr.ql linguist-generated
/test/extractor-tests/generated/expr/TypeValueExpr/TypeValueExpr_getType.ql linguist-generated
/test/extractor-tests/generated/expr/VarargExpansionExpr/MISSING_SOURCE.txt linguist-generated
/test/extractor-tests/generated/pattern/AnyPattern/MISSING_SOURCE.txt linguist-generated
/test/extractor-tests/generated/pattern/BindingPattern/MISSING_SOURCE.txt linguist-generated
@@ -1297,6 +1307,7 @@
/test/extractor-tests/generated/type/GenericFunctionType/MISSING_SOURCE.txt linguist-generated
/test/extractor-tests/generated/type/GenericTypeParamType/MISSING_SOURCE.txt linguist-generated
/test/extractor-tests/generated/type/InOutType/InOutType.ql linguist-generated
/test/extractor-tests/generated/type/IntegerType/IntegerType.ql linguist-generated
/test/extractor-tests/generated/type/LValueType/MISSING_SOURCE.txt linguist-generated
/test/extractor-tests/generated/type/MetatypeType/MISSING_SOURCE.txt linguist-generated
/test/extractor-tests/generated/type/ModuleType/ModuleType.ql linguist-generated

View File

@@ -185,6 +185,7 @@ import codeql.swift.elements.expr.TryExpr
import codeql.swift.elements.expr.TupleElementExpr
import codeql.swift.elements.expr.TupleExpr
import codeql.swift.elements.expr.TypeExpr
import codeql.swift.elements.expr.TypeValueExpr
import codeql.swift.elements.expr.UnderlyingToOpaqueExpr
import codeql.swift.elements.expr.UnevaluatedInstanceExpr
import codeql.swift.elements.expr.UnreachableExpr
@@ -272,6 +273,7 @@ import codeql.swift.elements.type.FunctionType
import codeql.swift.elements.type.GenericFunctionType
import codeql.swift.elements.type.GenericTypeParamType
import codeql.swift.elements.type.InOutType
import codeql.swift.elements.type.IntegerType
import codeql.swift.elements.type.LValueType
import codeql.swift.elements.type.LocalArchetypeType
import codeql.swift.elements.type.MetatypeType

View File

@@ -0,0 +1,10 @@
// generated by codegen/codegen.py, do not edit
/**
* This module provides the public class `TypeValueExpr`.
*/
private import internal.TypeValueExprImpl
import codeql.swift.elements.expr.Expr
import codeql.swift.elements.type.TypeRepr
final class TypeValueExpr = Impl::TypeValueExpr;

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

View 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 `TypeValueExpr`.
*
* INTERNAL: Do not use.
*/
private import codeql.swift.generated.expr.TypeValueExpr
/**
* INTERNAL: This module contains the customizable definition of `TypeValueExpr` and should not
* be referenced directly.
*/
module Impl {
class TypeValueExpr extends Generated::TypeValueExpr { }
}

View File

@@ -0,0 +1,9 @@
// generated by codegen/codegen.py, do not edit
/**
* This module provides the public class `IntegerType`.
*/
private import internal.IntegerTypeImpl
import codeql.swift.elements.type.Type
final class IntegerType = Impl::IntegerType;

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

View 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 `IntegerType`.
*
* INTERNAL: Do not use.
*/
private import codeql.swift.generated.type.IntegerType
/**
* INTERNAL: This module contains the customizable definition of `IntegerType` and should not
* be referenced directly.
*/
module Impl {
class IntegerType extends Generated::IntegerType { }
}

View File

@@ -2009,6 +2009,24 @@ private module Impl {
)
}
private Element getImmediateChildOfTypeValueExpr(
TypeValueExpr e, int index, string partialPredicateCall
) {
exists(int b, int bExpr, int n, int nTypeRepr |
b = 0 and
bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and
n = bExpr and
nTypeRepr = n + 1 and
(
none()
or
result = getImmediateChildOfExpr(e, index - b, partialPredicateCall)
or
index = n and result = e.getTypeRepr() and partialPredicateCall = "TypeRepr()"
)
)
}
private Element getImmediateChildOfUnresolvedDeclRefExpr(
UnresolvedDeclRefExpr e, int index, string partialPredicateCall
) {
@@ -4277,6 +4295,21 @@ private module Impl {
)
}
private Element getImmediateChildOfIntegerType(
IntegerType e, int index, string partialPredicateCall
) {
exists(int b, int bType, int n |
b = 0 and
bType = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfType(e, i, _)) | i) and
n = bType and
(
none()
or
result = getImmediateChildOfType(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfLValueType(LValueType e, int index, string partialPredicateCall) {
exists(int b, int bType, int n |
b = 0 and
@@ -5382,6 +5415,8 @@ private module Impl {
or
result = getImmediateChildOfTypeExpr(e, index, partialAccessor)
or
result = getImmediateChildOfTypeValueExpr(e, index, partialAccessor)
or
result = getImmediateChildOfUnresolvedDeclRefExpr(e, index, partialAccessor)
or
result = getImmediateChildOfUnresolvedDotExpr(e, index, partialAccessor)
@@ -5618,6 +5653,8 @@ private module Impl {
or
result = getImmediateChildOfInOutType(e, index, partialAccessor)
or
result = getImmediateChildOfIntegerType(e, index, partialAccessor)
or
result = getImmediateChildOfLValueType(e, index, partialAccessor)
or
result = getImmediateChildOfModuleType(e, index, partialAccessor)

View File

@@ -1853,6 +1853,18 @@ module Raw {
TypeRepr getTypeRepr() { type_expr_type_reprs(this, result) }
}
/**
* INTERNAL: Do not use.
*/
class TypeValueExpr extends @type_value_expr, Expr {
override string toString() { result = "TypeValueExpr" }
/**
* Gets the type representation of this type value expression.
*/
TypeRepr getTypeRepr() { type_value_exprs(this, result) }
}
/**
* INTERNAL: Do not use.
*/
@@ -3323,6 +3335,18 @@ module Raw {
Type getObjectType() { in_out_types(this, result) }
}
/**
* INTERNAL: Do not use.
*/
class IntegerType extends @integer_type, Type {
override string toString() { result = "IntegerType" }
/**
* Gets the value of this integer type.
*/
string getValue() { integer_types(this, result) }
}
/**
* INTERNAL: Do not use.
*/

View File

@@ -668,6 +668,10 @@ module Synth {
* INTERNAL: Do not use.
*/
TTypeExpr(Raw::TypeExpr id) { constructTypeExpr(id) } or
/**
* INTERNAL: Do not use.
*/
TTypeValueExpr(Raw::TypeValueExpr id) { constructTypeValueExpr(id) } or
/**
* INTERNAL: Do not use.
*/
@@ -994,6 +998,10 @@ module Synth {
* INTERNAL: Do not use.
*/
TInOutType(Raw::InOutType id) { constructInOutType(id) } or
/**
* INTERNAL: Do not use.
*/
TIntegerType(Raw::IntegerType id) { constructIntegerType(id) } or
/**
* INTERNAL: Do not use.
*/
@@ -1266,9 +1274,9 @@ module Synth {
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
TUnresolvedSpecializeExpr or TVarargExpansionExpr;
TTapExpr or TTupleElementExpr or TTupleExpr or TTypeExpr or TTypeValueExpr or
TUnresolvedDeclRefExpr or TUnresolvedDotExpr or TUnresolvedMemberExpr or
TUnresolvedPatternExpr or TUnresolvedSpecializeExpr or TVarargExpansionExpr;
/**
* INTERNAL: Do not use.
@@ -1426,9 +1434,9 @@ module Synth {
class TType =
TAnyFunctionType or TAnyGenericType or TAnyMetatypeType or TBuiltinType or
TDependentMemberType or TDynamicSelfType or TErrorType or TExistentialType or TInOutType or
TLValueType or TModuleType or TPackElementType or TPackExpansionType or TPackType or
TParameterizedProtocolType or TProtocolCompositionType or TReferenceStorageType or
TSubstitutableType or TSugarType or TTupleType or TUnresolvedType;
TIntegerType or TLValueType or TModuleType or TPackElementType or TPackExpansionType or
TPackType or TParameterizedProtocolType or TProtocolCompositionType or
TReferenceStorageType or TSubstitutableType or TSugarType or TTupleType or TUnresolvedType;
/**
* INTERNAL: Do not use.
@@ -2487,6 +2495,12 @@ module Synth {
*/
TTypeExpr convertTypeExprFromRaw(Raw::Element e) { result = TTypeExpr(e) }
/**
* INTERNAL: Do not use.
* Converts a raw element to a synthesized `TTypeValueExpr`, if possible.
*/
TTypeValueExpr convertTypeValueExprFromRaw(Raw::Element e) { result = TTypeValueExpr(e) }
/**
* INTERNAL: Do not use.
* Converts a raw element to a synthesized `TUnderlyingToOpaqueExpr`, if possible.
@@ -3003,6 +3017,12 @@ module Synth {
*/
TInOutType convertInOutTypeFromRaw(Raw::Element e) { result = TInOutType(e) }
/**
* INTERNAL: Do not use.
* Converts a raw element to a synthesized `TIntegerType`, if possible.
*/
TIntegerType convertIntegerTypeFromRaw(Raw::Element e) { result = TIntegerType(e) }
/**
* INTERNAL: Do not use.
* Converts a raw element to a synthesized `TLValueType`, if possible.
@@ -3674,6 +3694,8 @@ module Synth {
or
result = convertTypeExprFromRaw(e)
or
result = convertTypeValueExprFromRaw(e)
or
result = convertUnresolvedDeclRefExprFromRaw(e)
or
result = convertUnresolvedDotExprFromRaw(e)
@@ -4116,6 +4138,8 @@ module Synth {
or
result = convertInOutTypeFromRaw(e)
or
result = convertIntegerTypeFromRaw(e)
or
result = convertLValueTypeFromRaw(e)
or
result = convertModuleTypeFromRaw(e)
@@ -5203,6 +5227,12 @@ module Synth {
*/
Raw::Element convertTypeExprToRaw(TTypeExpr e) { e = TTypeExpr(result) }
/**
* INTERNAL: Do not use.
* Converts a synthesized `TTypeValueExpr` to a raw DB element, if possible.
*/
Raw::Element convertTypeValueExprToRaw(TTypeValueExpr e) { e = TTypeValueExpr(result) }
/**
* INTERNAL: Do not use.
* Converts a synthesized `TUnderlyingToOpaqueExpr` to a raw DB element, if possible.
@@ -5719,6 +5749,12 @@ module Synth {
*/
Raw::Element convertInOutTypeToRaw(TInOutType e) { e = TInOutType(result) }
/**
* INTERNAL: Do not use.
* Converts a synthesized `TIntegerType` to a raw DB element, if possible.
*/
Raw::Element convertIntegerTypeToRaw(TIntegerType e) { e = TIntegerType(result) }
/**
* INTERNAL: Do not use.
* Converts a synthesized `TLValueType` to a raw DB element, if possible.
@@ -6390,6 +6426,8 @@ module Synth {
or
result = convertTypeExprToRaw(e)
or
result = convertTypeValueExprToRaw(e)
or
result = convertUnresolvedDeclRefExprToRaw(e)
or
result = convertUnresolvedDotExprToRaw(e)
@@ -6832,6 +6870,8 @@ module Synth {
or
result = convertInOutTypeToRaw(e)
or
result = convertIntegerTypeToRaw(e)
or
result = convertLValueTypeToRaw(e)
or
result = convertModuleTypeToRaw(e)

View File

@@ -152,6 +152,7 @@ import codeql.swift.elements.expr.internal.TryExprConstructor
import codeql.swift.elements.expr.internal.TupleElementExprConstructor
import codeql.swift.elements.expr.internal.TupleExprConstructor
import codeql.swift.elements.expr.internal.TypeExprConstructor
import codeql.swift.elements.expr.internal.TypeValueExprConstructor
import codeql.swift.elements.expr.internal.UnderlyingToOpaqueExprConstructor
import codeql.swift.elements.expr.internal.UnevaluatedInstanceExprConstructor
import codeql.swift.elements.expr.internal.UnreachableExprConstructor
@@ -228,6 +229,7 @@ import codeql.swift.elements.type.internal.FunctionTypeConstructor
import codeql.swift.elements.type.internal.GenericFunctionTypeConstructor
import codeql.swift.elements.type.internal.GenericTypeParamTypeConstructor
import codeql.swift.elements.type.internal.InOutTypeConstructor
import codeql.swift.elements.type.internal.IntegerTypeConstructor
import codeql.swift.elements.type.internal.LValueTypeConstructor
import codeql.swift.elements.type.internal.MetatypeTypeConstructor
import codeql.swift.elements.type.internal.ModuleTypeConstructor

View File

@@ -0,0 +1,34 @@
// generated by codegen/codegen.py, do not edit
/**
* This module provides the generated definition of `TypeValueExpr`.
* INTERNAL: Do not import directly.
*/
private import codeql.swift.generated.Synth
private import codeql.swift.generated.Raw
import codeql.swift.elements.expr.internal.ExprImpl::Impl as ExprImpl
import codeql.swift.elements.type.TypeRepr
/**
* INTERNAL: This module contains the fully generated definition of `TypeValueExpr` and should not
* be referenced directly.
*/
module Generated {
/**
* INTERNAL: Do not reference the `Generated::TypeValueExpr` class directly.
* Use the subclass `TypeValueExpr`, where the following predicates are available.
*/
class TypeValueExpr extends Synth::TTypeValueExpr, ExprImpl::Expr {
override string getAPrimaryQlClass() { result = "TypeValueExpr" }
/**
* Gets the type representation of this type value expression.
*/
TypeRepr getTypeRepr() {
result =
Synth::convertTypeReprFromRaw(Synth::convertTypeValueExprToRaw(this)
.(Raw::TypeValueExpr)
.getTypeRepr())
}
}
}

View File

@@ -0,0 +1,30 @@
// generated by codegen/codegen.py, do not edit
/**
* This module provides the generated definition of `IntegerType`.
* INTERNAL: Do not import directly.
*/
private import codeql.swift.generated.Synth
private import codeql.swift.generated.Raw
import codeql.swift.elements.type.internal.TypeImpl::Impl as TypeImpl
/**
* INTERNAL: This module contains the fully generated definition of `IntegerType` and should not
* be referenced directly.
*/
module Generated {
/**
* INTERNAL: Do not reference the `Generated::IntegerType` class directly.
* Use the subclass `IntegerType`, where the following predicates are available.
*/
class IntegerType extends Synth::TIntegerType, TypeImpl::Type {
override string getAPrimaryQlClass() { result = "IntegerType" }
/**
* Gets the value of this integer type.
*/
string getValue() {
result = Synth::convertIntegerTypeToRaw(this).(Raw::IntegerType).getValue()
}
}
}

View File

@@ -819,6 +819,7 @@ arguments( //dir=expr
| @tuple_element_expr
| @tuple_expr
| @type_expr
| @type_value_expr
| @unresolved_decl_ref_expr
| @unresolved_dot_expr
| @unresolved_member_expr
@@ -1281,6 +1282,11 @@ type_expr_type_reprs( //dir=expr
int type_repr: @type_repr_or_none ref
);
type_value_exprs( //dir=expr
unique int id: @type_value_expr,
int type_repr: @type_repr_or_none ref
);
unresolved_decl_ref_exprs( //dir=expr
unique int id: @unresolved_decl_ref_expr
);
@@ -2132,6 +2138,7 @@ while_stmts( //dir=stmt
| @error_type
| @existential_type
| @in_out_type
| @integer_type
| @l_value_type
| @module_type
| @pack_element_type
@@ -2247,6 +2254,11 @@ in_out_types( //dir=type
int object_type: @type_or_none ref
);
integer_types( //dir=type
unique int id: @integer_type,
string value: string ref
);
l_value_types( //dir=type
unique int id: @l_value_type,
int object_type: @type_or_none ref

View File

@@ -9,6 +9,8 @@ predicate toBeTested(Element e) {
e instanceof File and
(exists(e.(File).getRelativePath()) or e instanceof UnknownFile)
or
e instanceof IntegerType
or
e instanceof ParameterizedProtocolType
or
e instanceof PackType

View File

@@ -0,0 +1,2 @@
| type_value_exprs.swift:4:13:4:13 | TypeValueExpr | hasType: | yes | getTypeRepr: | type_value_exprs.swift:4:13:4:13 | (no string representation) |
| type_value_exprs.swift:5:13:5:13 | TypeValueExpr | hasType: | yes | getTypeRepr: | type_value_exprs.swift:5:13:5:13 | (no string representation) |

View File

@@ -0,0 +1,11 @@
// generated by codegen/codegen.py, do not edit
import codeql.swift.elements
import TestUtils
from TypeValueExpr x, string hasType, TypeRepr getTypeRepr
where
toBeTested(x) and
not x.isUnknown() and
(if x.hasType() then hasType = "yes" else hasType = "no") and
getTypeRepr = x.getTypeRepr()
select x, "hasType:", hasType, "getTypeRepr:", getTypeRepr

View File

@@ -0,0 +1,2 @@
| type_value_exprs.swift:4:13:4:13 | TypeValueExpr | Int |
| type_value_exprs.swift:5:13:5:13 | TypeValueExpr | Int |

View File

@@ -0,0 +1,7 @@
// generated by codegen/codegen.py, do not edit
import codeql.swift.elements
import TestUtils
from TypeValueExpr x
where toBeTested(x) and not x.isUnknown()
select x, x.getType()

View File

@@ -0,0 +1,8 @@
//codeql-extractor-options: -enable-experimental-feature ValueGenerics -disable-availability-checking
struct A<let N: Int> {
var x = N;
var y = N;
}
func f(with a : A<128>) {}

View File

@@ -0,0 +1,2 @@
| 128 | getName: | 128 | getCanonicalType: | 128 | getValue: | 128 |
| 256 | getName: | 256 | getCanonicalType: | 256 | getValue: | 256 |

View File

@@ -0,0 +1,12 @@
// generated by codegen/codegen.py, do not edit
import codeql.swift.elements
import TestUtils
from IntegerType x, string getName, Type getCanonicalType, string getValue
where
toBeTested(x) and
not x.isUnknown() and
getName = x.getName() and
getCanonicalType = x.getCanonicalType() and
getValue = x.getValue()
select x, "getName:", getName, "getCanonicalType:", getCanonicalType, "getValue:", getValue

View File

@@ -0,0 +1,9 @@
//codeql-extractor-options: -enable-experimental-feature ValueGenerics -disable-availability-checking
struct A<let N: Int> {
var x = N;
}
func f(with a : A<128>) {}
func g(with a : A<256>) {}

View File

@@ -1469,3 +1469,9 @@ class UnsafeCastExpr(ImplicitConversionExpr):
"""
A conversion that performs an unsafe bitcast.
"""
class TypeValueExpr(Expr):
type_repr: TypeRepr | child
class IntegerType(Type):
value: string