diff --git a/swift/extractor/infra/SwiftTagTraits.h b/swift/extractor/infra/SwiftTagTraits.h index f7825043edda..7ea1d58a5763 100644 --- a/swift/extractor/infra/SwiftTagTraits.h +++ b/swift/extractor/infra/SwiftTagTraits.h @@ -146,7 +146,6 @@ MAP(swift::Expr, ExprTag) MAP(swift::ImplicitConversionExpr, ImplicitConversionExprTag) MAP(swift::LoadExpr, LoadExprTag) MAP(swift::DestructureTupleExpr, DestructureTupleExprTag) - MAP(swift::UnresolvedTypeConversionExpr, UnresolvedTypeConversionExprTag) MAP(swift::FunctionConversionExpr, FunctionConversionExprTag) MAP(swift::CovariantFunctionConversionExpr, CovariantFunctionConversionExprTag) MAP(swift::CovariantReturnConversionExpr, CovariantReturnConversionExprTag) @@ -267,8 +266,7 @@ MAP(swift::TypeRepr, TypeReprTag) MAP(swift::Type, TypeTag) MAP(swift::TypeBase, TypeTag) MAP(swift::ErrorType, ErrorTypeTag) - MAP(swift::UnresolvedType, UnresolvedTypeTag) - MAP(swift::PlaceholderType, void) // appears in ambiguous types but are then transformed to UnresolvedType + MAP(swift::PlaceholderType, void) // appears in ambiguous types but are then transformed to ErrorType MAP(swift::BuiltinType, BuiltinTypeTag) MAP(swift::AnyBuiltinIntegerType, AnyBuiltinIntegerTypeTag) MAP(swift::BuiltinIntegerType, BuiltinIntegerTypeTag) @@ -285,7 +283,8 @@ MAP(swift::TypeBase, TypeTag) MAP(swift::BuiltinVectorType, BuiltinVectorTypeTag) MAP(swift::BuiltinPackIndexType, void) // SIL type, cannot really appear in the frontend run MAP(swift::BuiltinNonDefaultDistributedActorStorageType, void) // Does not appear in AST/SIL, only used during IRGen - MAP(swift::BuiltinFixedArrayType, BuiltinFixedArrayTypeTag) + MAP(swift::BuiltinGenericType, BuiltinGenericTypeTag) + MAP(swift::BuiltinFixedArrayType, BuiltinFixedArrayTypeTag) MAP(swift::BuiltinUnboundGenericType, void) // Only used during type resolution MAP(swift::BuiltinImplicitActorType, void) // SIL type MAP(swift::TupleType, TupleTypeTag) diff --git a/swift/extractor/mangler/SwiftMangler.cpp b/swift/extractor/mangler/SwiftMangler.cpp index 8d7d2a8a0658..01e5466ee81b 100644 --- a/swift/extractor/mangler/SwiftMangler.cpp +++ b/swift/extractor/mangler/SwiftMangler.cpp @@ -40,8 +40,8 @@ std::string_view getTypeKindStr(const swift::TypeBase* type) { } // namespace -std::unordered_map - SwiftMangler::preloadedExtensionIndexes; +std::unordered_map + SwiftMangler::preloadedExtensionOrFilePrivateValueIndexes; SwiftMangledName SwiftMangler::initMangled(const swift::TypeBase* type) { return {getTypeKindStr(type), '_'}; @@ -75,6 +75,11 @@ SwiftMangledName SwiftMangler::visitValueDecl(const swift::ValueDecl* decl, bool if (decl->isStatic()) { ret << "|static"; } + if (decl->getFormalAccess() == swift::AccessLevel::FilePrivate) { + auto parent = getParent(decl); + auto index = getExtensionofFilePrivateValueIndex(decl, parent); + ret << "|fileprivate" << index.index; + } return ret; } @@ -105,17 +110,18 @@ SwiftMangledName SwiftMangler::visitExtensionDecl(const swift::ExtensionDecl* de auto parent = getParent(decl); auto target = decl->getExtendedType(); - auto index = getExtensionIndex(decl, parent); + auto index = getExtensionofFilePrivateValueIndex(decl, parent); return initMangled(decl) << fetch(target) << index.index << (index.kind == ExtensionKind::clang ? "_clang" : ""); } -SwiftMangler::ExtensionIndex SwiftMangler::getExtensionIndex(const swift::ExtensionDecl* decl, - const swift::Decl* parent) { - // to avoid iterating multiple times on the parent of multiple extensions, we preload extension - // indexes once for each encountered parent into the `preloadedExtensionIndexes` mapping. - if (auto found = SwiftMangler::preloadedExtensionIndexes.find(decl); - found != SwiftMangler::preloadedExtensionIndexes.end()) { +SwiftMangler::ExtensionOrFilePrivateValueIndex SwiftMangler::getExtensionofFilePrivateValueIndex( + const swift::Decl* decl, + const swift::Decl* parent) { + // to avoid iterating multiple times on the parent, we preload the indexes once for each + // encountered parent. + if (auto found = SwiftMangler::preloadedExtensionOrFilePrivateValueIndexes.find(decl); + found != SwiftMangler::preloadedExtensionOrFilePrivateValueIndexes.end()) { return found->second; } if (auto parentModule = llvm::dyn_cast(parent)) { @@ -131,10 +137,10 @@ SwiftMangler::ExtensionIndex SwiftMangler::getExtensionIndex(const swift::Extens // TODO use a generic logging handle for Swift entities here, once it's available CODEQL_ASSERT(false, "non-local context must be module or iterable decl context"); } - auto found = SwiftMangler::preloadedExtensionIndexes.find(decl); + auto found = SwiftMangler::preloadedExtensionOrFilePrivateValueIndexes.find(decl); // TODO use a generic logging handle for Swift entities here, once it's available - CODEQL_ASSERT(found != SwiftMangler::preloadedExtensionIndexes.end(), - "extension not found within parent"); + CODEQL_ASSERT(found != SwiftMangler::preloadedExtensionOrFilePrivateValueIndexes.end(), + "declaration not found within parent"); return found->second; } @@ -142,7 +148,14 @@ void SwiftMangler::indexExtensions(llvm::ArrayRef siblings) { auto index = 0u; for (auto sibling : siblings) { if (sibling->getKind() == swift::DeclKind::Extension) { - SwiftMangler::preloadedExtensionIndexes.try_emplace(sibling, ExtensionKind::swift, index); + SwiftMangler::preloadedExtensionOrFilePrivateValueIndexes.try_emplace( + sibling, ExtensionKind::swift, index); + index++; + } else if (swift::isa(sibling) && + swift::dyn_cast(sibling)->getFormalAccess() == + swift::AccessLevel::FilePrivate) { + SwiftMangler::preloadedExtensionOrFilePrivateValueIndexes.try_emplace( + sibling, ExtensionKind::swift, index); index++; } } @@ -161,7 +174,8 @@ void SwiftMangler::indexClangExtensions(const clang::Module* clangModule, swiftSubmodule->getTopLevelDecls(children); for (const auto child : children) { if (child->getKind() == swift::DeclKind::Extension) { - SwiftMangler::preloadedExtensionIndexes.try_emplace(child, ExtensionKind::clang, index); + SwiftMangler::preloadedExtensionOrFilePrivateValueIndexes.try_emplace( + child, ExtensionKind::clang, index); index++; } } @@ -202,6 +216,14 @@ SwiftMangledName SwiftMangler::visitBuiltinType(const swift::BuiltinType* type) return initMangled(type) << type->getTypeName(buffer, /* prependBuiltinNamespace= */ false); } +SwiftMangledName SwiftMangler::visitBuiltinFixedArrayType( + const swift::BuiltinFixedArrayType* type) { + auto ret = visitBuiltinType(type); + ret << fetch(type->getSize()); + ret << fetch(type->getElementType()); + return ret; +} + SwiftMangledName SwiftMangler::visitAnyGenericType(const swift::AnyGenericType* type) { auto ret = initMangled(type); auto decl = type->getDecl(); @@ -240,9 +262,6 @@ SwiftMangledName SwiftMangler::visitAnyFunctionType(const swift::AnyFunctionType if (flags.isNonEphemeral()) { ret << "_nonephermeral"; } - if (flags.isIsolated()) { - ret << "_isolated"; - } if (flags.isSending()) { ret << "_sending"; } @@ -309,9 +328,13 @@ SwiftMangledName SwiftMangler::visitAnyFunctionType(const swift::AnyFunctionType if (type->hasGlobalActor()) { ret << "_actor" << fetch(type->getGlobalActor()); } - if (type->getIsolation().isErased()) { + const auto& isolation = type->getIsolation(); + if (isolation.isErased()) { ret << "_isolated"; } + if (isolation.isNonIsolatedCaller()) { + ret << "_nonisolatednonsending"; + } // TODO: see if this needs to be used in identifying types, if not it needs to be removed from // type printing in the Swift compiler code assert(type->hasExtInfo() && "type must have ext info"); diff --git a/swift/extractor/mangler/SwiftMangler.h b/swift/extractor/mangler/SwiftMangler.h index caf70718633e..8d35626b0ee8 100644 --- a/swift/extractor/mangler/SwiftMangler.h +++ b/swift/extractor/mangler/SwiftMangler.h @@ -71,6 +71,7 @@ class SwiftMangler : private swift::TypeVisitor, SwiftMangledName visitModuleType(const swift::ModuleType* type); SwiftMangledName visitTupleType(const swift::TupleType* type); SwiftMangledName visitBuiltinType(const swift::BuiltinType* type); + SwiftMangledName visitBuiltinFixedArrayType(const swift::BuiltinFixedArrayType* type); SwiftMangledName visitAnyGenericType(const swift::AnyGenericType* type); // shouldn't be required, but they forgot to link `NominalType` to its direct superclass @@ -111,12 +112,13 @@ class SwiftMangler : private swift::TypeVisitor, clang, }; - struct ExtensionIndex { + struct ExtensionOrFilePrivateValueIndex { const ExtensionKind kind : 1; const uint32_t index : 31; }; - static std::unordered_map preloadedExtensionIndexes; + static std::unordered_map + preloadedExtensionOrFilePrivateValueIndexes; virtual SwiftMangledName fetch(const swift::Decl* decl) = 0; virtual SwiftMangledName fetch(const swift::TypeBase* type) = 0; @@ -125,7 +127,8 @@ class SwiftMangler : private swift::TypeVisitor, void indexExtensions(llvm::ArrayRef siblings); void indexClangExtensions(const clang::Module* clangModule, swift::ClangModuleLoader* moduleLoader); - ExtensionIndex getExtensionIndex(const swift::ExtensionDecl* decl, const swift::Decl* parent); + ExtensionOrFilePrivateValueIndex getExtensionofFilePrivateValueIndex(const swift::Decl* decl, + const swift::Decl* parent); static SwiftMangledName initMangled(const swift::TypeBase* type); SwiftMangledName initMangled(const swift::Decl* decl); SwiftMangledName visitTypeDiscriminatedValueDecl(const swift::ValueDecl* decl); diff --git a/swift/extractor/translators/StmtTranslator.cpp b/swift/extractor/translators/StmtTranslator.cpp index 1562c28f19c7..2b059682b331 100644 --- a/swift/extractor/translators/StmtTranslator.cpp +++ b/swift/extractor/translators/StmtTranslator.cpp @@ -137,7 +137,7 @@ codeql::CaseStmt StmtTranslator::translateCaseStmt(const swift::CaseStmt& stmt) auto entry = dispatcher.createEntry(stmt); entry.body = dispatcher.fetchLabel(stmt.getBody()); entry.labels = dispatcher.fetchRepeatedLabels(stmt.getCaseLabelItems()); - entry.variables = dispatcher.fetchRepeatedLabels(stmt.getCaseBodyVariablesOrEmptyArray()); + entry.variables = dispatcher.fetchRepeatedLabels(stmt.getCaseBodyVariables()); return entry; } diff --git a/swift/extractor/translators/TypeTranslator.cpp b/swift/extractor/translators/TypeTranslator.cpp index 52d17c7a3577..5d2d1e39667e 100644 --- a/swift/extractor/translators/TypeTranslator.cpp +++ b/swift/extractor/translators/TypeTranslator.cpp @@ -233,6 +233,14 @@ codeql::BuiltinIntegerType TypeTranslator::translateBuiltinIntegerType( return entry; } +codeql::BuiltinFixedArrayType TypeTranslator::translateBuiltinFixedArrayType( + const swift::BuiltinFixedArrayType& type) { + // currently the translate dispatching mechanism does not go up more than one step in the + // hierarchy so we need to put this explicitly here, as BuiltinFixedArrayType derives from + // BuiltinGenericType which then derives from BuiltinType + return translateBuiltinType(type); +} + codeql::ExistentialArchetypeType TypeTranslator::translateExistentialArchetypeType( const swift::ExistentialArchetypeType& type) { auto entry = createTypeEntry(type); @@ -258,10 +266,6 @@ codeql::ErrorType TypeTranslator::translateErrorType(const swift::ErrorType& typ return createTypeEntry(type); } -codeql::UnresolvedType TypeTranslator::translateUnresolvedType(const swift::UnresolvedType& type) { - return createTypeEntry(type); -} - codeql::ParameterizedProtocolType TypeTranslator::translateParameterizedProtocolType( const swift::ParameterizedProtocolType& type) { auto entry = createTypeEntry(type); diff --git a/swift/extractor/translators/TypeTranslator.h b/swift/extractor/translators/TypeTranslator.h index c65c0e757dec..fd211ec39e09 100644 --- a/swift/extractor/translators/TypeTranslator.h +++ b/swift/extractor/translators/TypeTranslator.h @@ -69,13 +69,14 @@ class TypeTranslator : public TypeTranslatorBase { codeql::BuiltinIntegerLiteralType translateBuiltinIntegerLiteralType( const swift::BuiltinIntegerLiteralType& type); codeql::BuiltinIntegerType translateBuiltinIntegerType(const swift::BuiltinIntegerType& type); + codeql::BuiltinFixedArrayType translateBuiltinFixedArrayType( + const swift::BuiltinFixedArrayType& type); codeql::ExistentialArchetypeType translateExistentialArchetypeType( const swift::ExistentialArchetypeType& type); codeql::ModuleType translateModuleType(const swift::ModuleType& type); codeql::OpaqueTypeArchetypeType translateOpaqueTypeArchetypeType( const swift::OpaqueTypeArchetypeType& type); codeql::ErrorType translateErrorType(const swift::ErrorType& type); - codeql::UnresolvedType translateUnresolvedType(const swift::UnresolvedType& type); codeql::ParameterizedProtocolType translateParameterizedProtocolType( const swift::ParameterizedProtocolType& type); codeql::PackArchetypeType translatePackArchetypeType(const swift::PackArchetypeType& type); diff --git a/swift/ql/.generated.list b/swift/ql/.generated.list index 8d2fb9a2ebca..a666c64948d4 100644 --- a/swift/ql/.generated.list +++ b/swift/ql/.generated.list @@ -539,8 +539,9 @@ lib/codeql/swift/elements/type/BoundGenericType.qll 089e5e8d09c62a23d575dcab68cd lib/codeql/swift/elements/type/BuiltinBridgeObjectType.qll b0064e09b53efe801b0bf950ff00698a84e2f714e853e4859ed5f3246025a1bd aa14b6ae2ec510c4ddd2cc073bf971809536ab8fd8763fd05bd171b0bbe83860 lib/codeql/swift/elements/type/BuiltinDefaultActorStorageType.qll e867a9d0b2c61b7eb61f5143c78e31f8d98d3245d79e0e3281d4c172175f496b 265e87f2e37ca968af572cc619294d1ee91dd66ebb0d1bb1ba9ab7159de52f0b lib/codeql/swift/elements/type/BuiltinExecutorType.qll 2b141553bbc02a00d97579ba9d0e38fa0978d40ce954b0caf64826aa259dbc08 a81465fd0e87ad5b8e418d8f21c337b3e96388a3b92b3332f0d6b0ff7663e5c7 -lib/codeql/swift/elements/type/BuiltinFixedArrayType.qll 24a57f15a53070e6308841cd5dac4d55059e84d9fb18a77eec1130647dcdc97c 9f4167ef5190cbeee71abd068bdb0a280b690a16349cd408244d4cf9edfb357a +lib/codeql/swift/elements/type/BuiltinFixedArrayType.qll 9d32f49cd7169d12c00cde31433897e8f8ada62132430020dc2525a97673cf57 0236f494f6ce77b04a80e405d11f5b39b1e45ea9c50a6ee42dd96407516b448f lib/codeql/swift/elements/type/BuiltinFloatType.qll 81f49325077b75cea682904ddab24d1b2fdc5c93b0b28830c08e866d5c9307a7 e26a348d66e3824ccd92729624ce2b2ebc82a844aa47035e0a963a62b08b772d +lib/codeql/swift/elements/type/BuiltinGenericType.qll 108682444f5f28b64b7caa16254fd4d7418813bc9e7f6a17477b13fe37293d40 de3fa330516684f0cfd848101b3a93f83b2d8a9f00b35dae70d2b56cb5414923 lib/codeql/swift/elements/type/BuiltinIntegerLiteralType.qll 34ee35733cf26f90d799a79f8a2362b199ea2ecb6ba83eb5678dda9eb3ed255f e33fdb27d3c22d441277b66ba74136cb88e1da25a2146391b258c68f7fbf5dd3 lib/codeql/swift/elements/type/BuiltinIntegerType.qll b931e79a40fb379a8de377ae4ea1c85befb7b07dbfe913f0ea7f5adf5514b217 5d7e6f21284b8c5ff70773bb64f896a40541c9064bfdd336798ccfda4cb4fb9e lib/codeql/swift/elements/type/BuiltinJobType.qll 4b4cab766d8476efd7482ab47f6fdd63fd90a322e1e791949351092f126f5b46 779ceee86a778b59a3feb5247603fe07e4a73068a7990e25c31dd93ba0dd718d @@ -623,6 +624,7 @@ lib/codeql/swift/elements/type/internal/BuiltinFixedArrayTypeConstructor.qll 0d5 lib/codeql/swift/elements/type/internal/BuiltinFixedArrayTypeImpl.qll 6b69ba8b271646bcd699e338f41c186f3e4e7d401830918407e392312b2f0ad1 ecaca3d762264423094f7c2cb63e33b5d72d970946766eec33d984fa977950b4 lib/codeql/swift/elements/type/internal/BuiltinFloatTypeConstructor.qll f1dab7b9d36213e57083a6effec1b2d859553831394c0e746c592c96a20db6de cceeaa864cfc84511b3cdad6a88d44fc14ea1c8e38db72b0854c3f217a3f9c44 lib/codeql/swift/elements/type/internal/BuiltinFloatTypeImpl.qll 1dc7f7817c4a238751875b0cee98d060a1ea975a22fd90ceef0f9874b85824d6 d98f743c28174fb3294f0ff60232600a4fc80aeefe72e5cc15bb56e09880ec1e +lib/codeql/swift/elements/type/internal/BuiltinGenericTypeImpl.qll 2735ef1521c399540ef43fc75aa62b4bbb1871446d87304c9e3a991ad16a96f4 263e41354843afc5d1f57bd2f50610992d05d77ceb1c2079587ddd3a1eceffc5 lib/codeql/swift/elements/type/internal/BuiltinIntegerLiteralTypeConstructor.qll 3885775f78e18286aa8dc99ab5b6f386a278b34b47f93da28d67faac918e6087 93be2ad0b7235bab613b74582bc1de0ca8b2a4da7a387d09a9b8ef9b38095534 lib/codeql/swift/elements/type/internal/BuiltinIntegerLiteralTypeImpl.qll 7f078bd837acddd0e835f78b0ae6e0381c9c587e82edc61cf78986ce0081e314 f141415be39f8a5f09d4a90cc5d841f90385c3be8781c0bafbad0871681ec8a3 lib/codeql/swift/elements/type/internal/BuiltinIntegerTypeConstructor.qll 2c5a7884c5c8c852d81b6ce03f9c6cc036944428731e3a73208c0d2047b72611 abd29915698109395a4751999aa334ba3c020f20372a5dff213acdd672d024a9 @@ -721,7 +723,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 ec0104a658330f595eac7dd8578d996905a6c2cf78765744c3967a8f3d1c3273 ec0104a658330f595eac7dd8578d996905a6c2cf78765744c3967a8f3d1c3273 +lib/codeql/swift/elements.qll 70e20ccd31c9247904fb5ef00ccbda5a6d29c680e88b0ed238f4b4546abf5f33 70e20ccd31c9247904fb5ef00ccbda5a6d29c680e88b0ed238f4b4546abf5f33 lib/codeql/swift/generated/AstNode.qll 6fb80e9b230a1e3ae8193af40744f253d5cc81dc4239156924e5ab606c491efc e5c28418e9a38bde08f323a3986a199620189fc4a8a4dc8f670610a5d3d65b99 lib/codeql/swift/generated/AvailabilityInfo.qll e3a5274c43e72ff124b6988fd8be0c83a41b89337e11104150dd0ca7f51d8a11 889563791ca8d9758dbbccf64a0731c4bdbf721cad32bc6cd723f1072b6aa1de lib/codeql/swift/generated/AvailabilitySpec.qll 1bd2a0ee085f802c99090e681ab3339fc5013024d79deef39f376de12ab76d37 658f2eb51860726cfa6808b3e3501d624e0734750d1420f7a25c89782f1f6c7e @@ -737,10 +739,10 @@ lib/codeql/swift/generated/KeyPathComponent.qll e11dcf952045b5e6062e24c23515cff9 lib/codeql/swift/generated/Locatable.qll 1d37fa20de71c0b9986bfd7a7c0cb82ab7bf3fda2d2008700f955ad82ce109a7 e97d4d4fb8a4800e0008cc00f60c8ed9b1ebd5f1140fd85e68b034616178d721 lib/codeql/swift/generated/Location.qll 5e20316c3e480ddfe632b7e88e016c19f10a67df1f6ae9c8f128755a6907d6f5 5a0af2d070bcb2ed53d6d0282bf9c60dc64c2dce89c21fdd485e9c7893c1c8fa lib/codeql/swift/generated/MacroRole.qll facf907e75490d69cd401c491215e4719324d751f40ea46c86ccf24cf3663c1f 969d8d4b44e3f1a9c193a152a4d83a303e56d2dbb871fc920c47a33f699cf018 -lib/codeql/swift/generated/ParentChild.qll 7fdc133bdec6cc223d5ee85e757b02c5d2e1ab121bcf269bb48c8a12a31a61e9 d8dd6e21d290a293db4db510b1523a9ea428b12f48b7574f03acf00b9ca065ef +lib/codeql/swift/generated/ParentChild.qll 669d39245f2cb735cfd4bcebdb551ef8f334fef5297c5834a8b09ebfa655856e 59b283c8a30b6b364c853302ab919ea713e0289e7b793b08b46fc87178d14a6a lib/codeql/swift/generated/PureSynthConstructors.qll bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4 bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4 -lib/codeql/swift/generated/Raw.qll 6adc2ec210e91051b6d3d6c84117b827f10dbea682a18b69348d1c6cdc53629c 9ff02fcca7a7b83c85303ffc6daa00ea392da6ce1f9cb389b5053b34d4a45e4c -lib/codeql/swift/generated/Synth.qll b0084d1f573ba1b10ec8a8fab169b15f15866ecb9a6aeeeac81553a442be28e3 09efe455f3fd6b8b983b30efbd797f09af46e6f5a1a1075801650528999ed938 +lib/codeql/swift/generated/Raw.qll c209a47a66f24f54bdfb5adf591dd171b2dbe9e30936a2355160526b9f756399 378e7492ca885f46092628ca26afa76c909deb88f092fe56404fea8f94d133b0 +lib/codeql/swift/generated/Synth.qll e30b50d2645d9c36719d81f1be70712c7c6e89a3f5b4a5ae894411e045d05bff 9bd0c9c90532db97cde9553dde4089b7cf12c462c690d853fa40cb36ea112c21 lib/codeql/swift/generated/SynthConstructors.qll c40f01e1331bdbe238620a41d17409cefe34a6b23066708ef5d74f8631b54f48 c40f01e1331bdbe238620a41d17409cefe34a6b23066708ef5d74f8631b54f48 lib/codeql/swift/generated/UnknownFile.qll 247ddf2ebb49ce5ed4bf7bf91a969ddff37de6c78d43d8affccaf7eb586e06f2 452b29f0465ef45e978ef8b647b75e5a2a1e53f2a568fc003bc8f52f73b3fa4d lib/codeql/swift/generated/UnknownLocation.qll d871000b4f53ffca4f67ea23ca5626e5dcce125d62a4d4b9969e08cc974af6fc b05971d7774e60790362fb810fb7086314f40a2de747b8cb1bc823ec6494a4dd @@ -978,8 +980,9 @@ lib/codeql/swift/generated/type/BoundGenericType.qll 5e7a2210b766437ca301f9675f7 lib/codeql/swift/generated/type/BuiltinBridgeObjectType.qll 97f30768a8788ec4547ce8a8f06fdd165286177e3819bf2e6590b9479f5bada4 ea3161c34d1d18783b38deac43c73048e4510015307d93f77cd95c149e988846 lib/codeql/swift/generated/type/BuiltinDefaultActorStorageType.qll 10e49de9a8bc3e67285c111f7869c8baceb70e478661d5557ebc8c86f41b4aec 1a0ce85eb325f666fbc2ac49c6f994efd552de6f2105e0a7ba9a10e39f3d1591 lib/codeql/swift/generated/type/BuiltinExecutorType.qll 8f58d4d413910aded894bfa9b54748adfc2b78f4ee271ac6db5f5b0214f36a66 69da70d76146155529b7b2426b3a459abe318f887240aac1aed5719fda5f386a -lib/codeql/swift/generated/type/BuiltinFixedArrayType.qll 9bd26596da9137b07324222c9ed39ec0781e44673314fba96a0c7cf16f65cc7d cc2d40961b070a89f3350ab95b92ae33372277e499d7b2a9ea34721cc1fe1923 +lib/codeql/swift/generated/type/BuiltinFixedArrayType.qll 2ae9d1ef215c725bc27f69d25247d360ee8aa0aa5a757df6b8e9734821084435 2f1caacf0f95c8f863296f0cc0a56abac4bf58ddc68e9ed63b5d8672fd21172d lib/codeql/swift/generated/type/BuiltinFloatType.qll 6306a806107bba052fe0b1335c8c4d4391cdb6aa5f42f14c70743113928c4c36 3265d571630c0437e5d81ba20a0b6112b7e88ee3ffca737557186001cf8aa04a +lib/codeql/swift/generated/type/BuiltinGenericType.qll 6cd1b5da102e221f25a301c284ccc9cbd64d595596787df1a4fd3f2a92ded077 3ae4c8676a868205c5334646e395b8fc4e561ee2f4c115003ae2f4ed83197b76 lib/codeql/swift/generated/type/BuiltinIntegerLiteralType.qll 3f49aac9b81c440b902a658294cf95aff5cb79b0d6cee8b1abd8a08ad45c7966 6c184dcf5d9376f193f07fe4722ea7cab51f1dfdef4d72c3042842d73cca31fe lib/codeql/swift/generated/type/BuiltinIntegerType.qll 3cfcbc4ebea6051d1f6dedcf098888c72c02bf697cebb52a0060c1885bea61f0 1c78df7a184e3615024d6e361b88dd619828a0aa7d342564610a95b02cc67d1e lib/codeql/swift/generated/type/BuiltinJobType.qll dc0e1932e972936001b1d688d6e70d7395184eef3c4242cebf3a2608d6607785 e5573304f6043f79cfc28e35744fd390eaebcb86a6f2758cc96aba588c1b8cb9 diff --git a/swift/ql/.gitattributes b/swift/ql/.gitattributes index 37f29b6947ed..212221509d0b 100644 --- a/swift/ql/.gitattributes +++ b/swift/ql/.gitattributes @@ -543,6 +543,7 @@ /lib/codeql/swift/elements/type/BuiltinExecutorType.qll linguist-generated /lib/codeql/swift/elements/type/BuiltinFixedArrayType.qll linguist-generated /lib/codeql/swift/elements/type/BuiltinFloatType.qll linguist-generated +/lib/codeql/swift/elements/type/BuiltinGenericType.qll linguist-generated /lib/codeql/swift/elements/type/BuiltinIntegerLiteralType.qll linguist-generated /lib/codeql/swift/elements/type/BuiltinIntegerType.qll linguist-generated /lib/codeql/swift/elements/type/BuiltinJobType.qll linguist-generated @@ -625,6 +626,7 @@ /lib/codeql/swift/elements/type/internal/BuiltinFixedArrayTypeImpl.qll linguist-generated /lib/codeql/swift/elements/type/internal/BuiltinFloatTypeConstructor.qll linguist-generated /lib/codeql/swift/elements/type/internal/BuiltinFloatTypeImpl.qll linguist-generated +/lib/codeql/swift/elements/type/internal/BuiltinGenericTypeImpl.qll linguist-generated /lib/codeql/swift/elements/type/internal/BuiltinIntegerLiteralTypeConstructor.qll linguist-generated /lib/codeql/swift/elements/type/internal/BuiltinIntegerLiteralTypeImpl.qll linguist-generated /lib/codeql/swift/elements/type/internal/BuiltinIntegerTypeConstructor.qll linguist-generated @@ -982,6 +984,7 @@ /lib/codeql/swift/generated/type/BuiltinExecutorType.qll linguist-generated /lib/codeql/swift/generated/type/BuiltinFixedArrayType.qll linguist-generated /lib/codeql/swift/generated/type/BuiltinFloatType.qll linguist-generated +/lib/codeql/swift/generated/type/BuiltinGenericType.qll linguist-generated /lib/codeql/swift/generated/type/BuiltinIntegerLiteralType.qll linguist-generated /lib/codeql/swift/generated/type/BuiltinIntegerType.qll linguist-generated /lib/codeql/swift/generated/type/BuiltinJobType.qll linguist-generated diff --git a/swift/ql/integration-tests/posix/deduplication/BuiltinTypes.expected b/swift/ql/integration-tests/posix/deduplication/BuiltinTypes.expected index 0f0a0220445b..1ca837955b63 100644 --- a/swift/ql/integration-tests/posix/deduplication/BuiltinTypes.expected +++ b/swift/ql/integration-tests/posix/deduplication/BuiltinTypes.expected @@ -4,6 +4,7 @@ | Builtin.FPIEEE64 | BuiltinFloatType | | Builtin.FixedArray<\u03c4_0_0, \u03c4_0_1> | BuiltinFixedArrayType | | Builtin.FixedArray | BuiltinFixedArrayType | +| Builtin.FixedArray | BuiltinFixedArrayType | | Builtin.Int1 | BuiltinIntegerType | | Builtin.Int8 | BuiltinIntegerType | | Builtin.Int16 | BuiltinIntegerType | diff --git a/swift/ql/lib/codeql/swift/elements.qll b/swift/ql/lib/codeql/swift/elements.qll index bdffeba5261f..6a39c4657785 100644 --- a/swift/ql/lib/codeql/swift/elements.qll +++ b/swift/ql/lib/codeql/swift/elements.qll @@ -252,6 +252,7 @@ import codeql.swift.elements.type.BuiltinDefaultActorStorageType import codeql.swift.elements.type.BuiltinExecutorType import codeql.swift.elements.type.BuiltinFixedArrayType import codeql.swift.elements.type.BuiltinFloatType +import codeql.swift.elements.type.BuiltinGenericType import codeql.swift.elements.type.BuiltinIntegerLiteralType import codeql.swift.elements.type.BuiltinIntegerType import codeql.swift.elements.type.BuiltinJobType diff --git a/swift/ql/lib/codeql/swift/elements/type/BuiltinFixedArrayType.qll b/swift/ql/lib/codeql/swift/elements/type/BuiltinFixedArrayType.qll index bf523a0a7852..996c38d127bf 100644 --- a/swift/ql/lib/codeql/swift/elements/type/BuiltinFixedArrayType.qll +++ b/swift/ql/lib/codeql/swift/elements/type/BuiltinFixedArrayType.qll @@ -4,7 +4,7 @@ */ private import internal.BuiltinFixedArrayTypeImpl -import codeql.swift.elements.type.BuiltinType +import codeql.swift.elements.type.BuiltinGenericType /** * A builtin type representing N values stored contiguously. diff --git a/swift/ql/lib/codeql/swift/elements/type/BuiltinGenericType.qll b/swift/ql/lib/codeql/swift/elements/type/BuiltinGenericType.qll new file mode 100644 index 000000000000..4513423fd608 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/type/BuiltinGenericType.qll @@ -0,0 +1,12 @@ +// generated by codegen/codegen.py, do not edit +/** + * This module provides the public class `BuiltinGenericType`. + */ + +private import internal.BuiltinGenericTypeImpl +import codeql.swift.elements.type.BuiltinType + +/** + * A builtin generic type. + */ +final class BuiltinGenericType = Impl::BuiltinGenericType; diff --git a/swift/ql/lib/codeql/swift/elements/type/internal/BuiltinGenericTypeImpl.qll b/swift/ql/lib/codeql/swift/elements/type/internal/BuiltinGenericTypeImpl.qll new file mode 100644 index 000000000000..0e475d64f010 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/type/internal/BuiltinGenericTypeImpl.qll @@ -0,0 +1,19 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `BuiltinGenericType`. + * + * INTERNAL: Do not use. + */ + +private import codeql.swift.generated.type.BuiltinGenericType + +/** + * INTERNAL: This module contains the customizable definition of `BuiltinGenericType` and should not + * be referenced directly. + */ +module Impl { + /** + * A builtin generic type. + */ + class BuiltinGenericType extends Generated::BuiltinGenericType { } +} diff --git a/swift/ql/lib/codeql/swift/generated/ParentChild.qll b/swift/ql/lib/codeql/swift/generated/ParentChild.qll index efed12bb5fe0..424fd7af75e9 100644 --- a/swift/ql/lib/codeql/swift/generated/ParentChild.qll +++ b/swift/ql/lib/codeql/swift/generated/ParentChild.qll @@ -2972,12 +2972,6 @@ private module Impl { none() } - private Element getImmediateChildOfBuiltinFixedArrayType( - BuiltinFixedArrayType e, int index, string partialPredicateCall - ) { - none() - } - private Element getImmediateChildOfBuiltinFloatType( BuiltinFloatType e, int index, string partialPredicateCall ) { @@ -3084,6 +3078,12 @@ private module Impl { none() } + private Element getImmediateChildOfBuiltinFixedArrayType( + BuiltinFixedArrayType e, int index, string partialPredicateCall + ) { + none() + } + private Element getImmediateChildOfBuiltinIntegerLiteralType( BuiltinIntegerLiteralType e, int index, string partialPredicateCall ) { @@ -3636,8 +3636,6 @@ private module Impl { or result = getImmediateChildOfBuiltinExecutorType(e, index, partialAccessor) or - result = getImmediateChildOfBuiltinFixedArrayType(e, index, partialAccessor) - or result = getImmediateChildOfBuiltinFloatType(e, index, partialAccessor) or result = getImmediateChildOfBuiltinJobType(e, index, partialAccessor) @@ -3674,6 +3672,8 @@ private module Impl { or result = getImmediateChildOfWeakStorageType(e, index, partialAccessor) or + result = getImmediateChildOfBuiltinFixedArrayType(e, index, partialAccessor) + or result = getImmediateChildOfBuiltinIntegerLiteralType(e, index, partialAccessor) or result = getImmediateChildOfBuiltinIntegerType(e, index, partialAccessor) diff --git a/swift/ql/lib/codeql/swift/generated/Raw.qll b/swift/ql/lib/codeql/swift/generated/Raw.qll index 714579218bcb..c2c65234cd4b 100644 --- a/swift/ql/lib/codeql/swift/generated/Raw.qll +++ b/swift/ql/lib/codeql/swift/generated/Raw.qll @@ -6293,24 +6293,18 @@ module Raw { /** * INTERNAL: Do not use. - * A builtin type representing N values stored contiguously. */ - class BuiltinFixedArrayType extends @builtin_fixed_array_type, BuiltinType { - override string toString() { result = "BuiltinFixedArrayType" } + class BuiltinFloatType extends @builtin_float_type, BuiltinType { + override string toString() { result = "BuiltinFloatType" } } - private Element getImmediateChildOfBuiltinFixedArrayType(BuiltinFixedArrayType e, int index) { - none() - } + private Element getImmediateChildOfBuiltinFloatType(BuiltinFloatType e, int index) { none() } /** * INTERNAL: Do not use. + * A builtin generic type. */ - class BuiltinFloatType extends @builtin_float_type, BuiltinType { - override string toString() { result = "BuiltinFloatType" } - } - - private Element getImmediateChildOfBuiltinFloatType(BuiltinFloatType e, int index) { none() } + class BuiltinGenericType extends @builtin_generic_type, BuiltinType { } /** * INTERNAL: Do not use. @@ -6537,6 +6531,18 @@ module Raw { int getNumberOfArgTypes() { result = count(int i | bound_generic_type_arg_types(this, i, _)) } } + /** + * INTERNAL: Do not use. + * A builtin type representing N values stored contiguously. + */ + class BuiltinFixedArrayType extends @builtin_fixed_array_type, BuiltinGenericType { + override string toString() { result = "BuiltinFixedArrayType" } + } + + private Element getImmediateChildOfBuiltinFixedArrayType(BuiltinFixedArrayType e, int index) { + none() + } + /** * INTERNAL: Do not use. */ @@ -7224,8 +7230,6 @@ module Raw { or result = getImmediateChildOfBuiltinExecutorType(e, index) or - result = getImmediateChildOfBuiltinFixedArrayType(e, index) - or result = getImmediateChildOfBuiltinFloatType(e, index) or result = getImmediateChildOfBuiltinJobType(e, index) @@ -7262,6 +7266,8 @@ module Raw { or result = getImmediateChildOfWeakStorageType(e, index) or + result = getImmediateChildOfBuiltinFixedArrayType(e, index) + or result = getImmediateChildOfBuiltinIntegerLiteralType(e, index) or result = getImmediateChildOfBuiltinIntegerType(e, index) diff --git a/swift/ql/lib/codeql/swift/generated/Synth.qll b/swift/ql/lib/codeql/swift/generated/Synth.qll index 27508df94e97..cd847f3e6afd 100644 --- a/swift/ql/lib/codeql/swift/generated/Synth.qll +++ b/swift/ql/lib/codeql/swift/generated/Synth.qll @@ -1392,12 +1392,17 @@ module Synth { class TBoundGenericType = TBoundGenericClassType or TBoundGenericEnumType or TBoundGenericStructType; + /** + * INTERNAL: Do not use. + */ + class TBuiltinGenericType = TBuiltinFixedArrayType; + /** * INTERNAL: Do not use. */ class TBuiltinType = TAnyBuiltinIntegerType or TBuiltinBridgeObjectType or TBuiltinDefaultActorStorageType or - TBuiltinExecutorType or TBuiltinFixedArrayType or TBuiltinFloatType or TBuiltinJobType or + TBuiltinExecutorType or TBuiltinFloatType or TBuiltinGenericType or TBuiltinJobType or TBuiltinNativeObjectType or TBuiltinRawPointerType or TBuiltinRawUnsafeContinuationType or TBuiltinUnsafeValueBufferType or TBuiltinVectorType; @@ -4291,6 +4296,14 @@ module Synth { result = convertBoundGenericStructTypeFromRaw(e) } + /** + * INTERNAL: Do not use. + * Converts a raw DB element to a synthesized `TBuiltinGenericType`, if possible. + */ + TBuiltinGenericType convertBuiltinGenericTypeFromRaw(Raw::Element e) { + result = convertBuiltinFixedArrayTypeFromRaw(e) + } + /** * INTERNAL: Do not use. * Converts a raw DB element to a synthesized `TBuiltinType`, if possible. @@ -4304,10 +4317,10 @@ module Synth { or result = convertBuiltinExecutorTypeFromRaw(e) or - result = convertBuiltinFixedArrayTypeFromRaw(e) - or result = convertBuiltinFloatTypeFromRaw(e) or + result = convertBuiltinGenericTypeFromRaw(e) + or result = convertBuiltinJobTypeFromRaw(e) or result = convertBuiltinNativeObjectTypeFromRaw(e) @@ -7037,6 +7050,14 @@ module Synth { result = convertBoundGenericStructTypeToRaw(e) } + /** + * INTERNAL: Do not use. + * Converts a synthesized `TBuiltinGenericType` to a raw DB element, if possible. + */ + Raw::Element convertBuiltinGenericTypeToRaw(TBuiltinGenericType e) { + result = convertBuiltinFixedArrayTypeToRaw(e) + } + /** * INTERNAL: Do not use. * Converts a synthesized `TBuiltinType` to a raw DB element, if possible. @@ -7050,10 +7071,10 @@ module Synth { or result = convertBuiltinExecutorTypeToRaw(e) or - result = convertBuiltinFixedArrayTypeToRaw(e) - or result = convertBuiltinFloatTypeToRaw(e) or + result = convertBuiltinGenericTypeToRaw(e) + or result = convertBuiltinJobTypeToRaw(e) or result = convertBuiltinNativeObjectTypeToRaw(e) diff --git a/swift/ql/lib/codeql/swift/generated/type/BuiltinFixedArrayType.qll b/swift/ql/lib/codeql/swift/generated/type/BuiltinFixedArrayType.qll index b61533168b77..5ed9491607af 100644 --- a/swift/ql/lib/codeql/swift/generated/type/BuiltinFixedArrayType.qll +++ b/swift/ql/lib/codeql/swift/generated/type/BuiltinFixedArrayType.qll @@ -6,7 +6,7 @@ private import codeql.swift.generated.Synth private import codeql.swift.generated.Raw -import codeql.swift.elements.type.internal.BuiltinTypeImpl::Impl as BuiltinTypeImpl +import codeql.swift.elements.type.internal.BuiltinGenericTypeImpl::Impl as BuiltinGenericTypeImpl /** * INTERNAL: This module contains the fully generated definition of `BuiltinFixedArrayType` and should not @@ -18,7 +18,9 @@ module Generated { * INTERNAL: Do not reference the `Generated::BuiltinFixedArrayType` class directly. * Use the subclass `BuiltinFixedArrayType`, where the following predicates are available. */ - class BuiltinFixedArrayType extends Synth::TBuiltinFixedArrayType, BuiltinTypeImpl::BuiltinType { + class BuiltinFixedArrayType extends Synth::TBuiltinFixedArrayType, + BuiltinGenericTypeImpl::BuiltinGenericType + { override string getAPrimaryQlClass() { result = "BuiltinFixedArrayType" } } } diff --git a/swift/ql/lib/codeql/swift/generated/type/BuiltinGenericType.qll b/swift/ql/lib/codeql/swift/generated/type/BuiltinGenericType.qll new file mode 100644 index 000000000000..cfed16ac2832 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/type/BuiltinGenericType.qll @@ -0,0 +1,22 @@ +// generated by codegen/codegen.py, do not edit +/** + * This module provides the generated definition of `BuiltinGenericType`. + * INTERNAL: Do not import directly. + */ + +private import codeql.swift.generated.Synth +private import codeql.swift.generated.Raw +import codeql.swift.elements.type.internal.BuiltinTypeImpl::Impl as BuiltinTypeImpl + +/** + * INTERNAL: This module contains the fully generated definition of `BuiltinGenericType` and should not + * be referenced directly. + */ +module Generated { + /** + * A builtin generic type. + * INTERNAL: Do not reference the `Generated::BuiltinGenericType` class directly. + * Use the subclass `BuiltinGenericType`, where the following predicates are available. + */ + class BuiltinGenericType extends Synth::TBuiltinGenericType, BuiltinTypeImpl::BuiltinType { } +} diff --git a/swift/ql/lib/swift.dbscheme b/swift/ql/lib/swift.dbscheme index 33e5e5e03bd3..ee3053b673c9 100644 --- a/swift/ql/lib/swift.dbscheme +++ b/swift/ql/lib/swift.dbscheme @@ -2266,8 +2266,8 @@ any_generic_type_parents( //dir=type | @builtin_bridge_object_type | @builtin_default_actor_storage_type | @builtin_executor_type -| @builtin_fixed_array_type | @builtin_float_type +| @builtin_generic_type | @builtin_job_type | @builtin_native_object_type | @builtin_raw_pointer_type @@ -2449,14 +2449,14 @@ builtin_executor_types( //dir=type unique int id: @builtin_executor_type ); -builtin_fixed_array_types( //dir=type - unique int id: @builtin_fixed_array_type -); - builtin_float_types( //dir=type unique int id: @builtin_float_type ); +@builtin_generic_type = + @builtin_fixed_array_type +; + builtin_job_types( //dir=type unique int id: @builtin_job_type ); @@ -2558,6 +2558,10 @@ bound_generic_type_arg_types( //dir=type int arg_type: @type_or_none ref ); +builtin_fixed_array_types( //dir=type + unique int id: @builtin_fixed_array_type +); + builtin_integer_literal_types( //dir=type unique int id: @builtin_integer_literal_type ); diff --git a/swift/ql/test/extractor-tests/declarations/all.expected b/swift/ql/test/extractor-tests/declarations/all.expected index 98b948953451..109e80ee4f60 100644 --- a/swift/ql/test/extractor-tests/declarations/all.expected +++ b/swift/ql/test/extractor-tests/declarations/all.expected @@ -116,6 +116,7 @@ | declarations.swift:77:16:77:23 | var ... = ... | | | declarations.swift:77:20:77:20 | _x | | | declarations.swift:77:20:77:20 | get | | +| declarations.swift:77:20:77:20 | var ... = ... | | | declarations.swift:77:20:77:20 | x | | | declarations.swift:81:1:136:1 | HasPropertyAndObserver | | | declarations.swift:81:8:81:8 | HasPropertyAndObserver.init(normalField:hasWillSet1:hasWillSet2:hasDidSet1:hasDidSet2:hasBoth:) | | diff --git a/swift/ql/test/extractor-tests/errors/Errors.expected b/swift/ql/test/extractor-tests/errors/Errors.expected index 50ab8ec658be..51900bf11d01 100644 --- a/swift/ql/test/extractor-tests/errors/Errors.expected +++ b/swift/ql/test/extractor-tests/errors/Errors.expected @@ -1,6 +1,6 @@ -| file://:0:0:0:0 | <> | ErrorType | -| file://:0:0:0:0 | <> | ErrorType | -| file://:0:0:0:0 | <> | ErrorType | +| file://:0:0:0:0 | _ | ErrorType | +| file://:0:0:0:0 | _ | ErrorType | +| file://:0:0:0:0 | _ | ErrorType | | overloaded.swift:6:5:6:5 | OverloadedDeclRefExpr | OverloadedDeclRefExpr | | unresolved.swift:5:1:5:14 | UnresolvedSpecializeExpr | UnresolvedSpecializeExpr | | unspecified.swift:3:1:3:23 | missing extended_type_decl from ExtensionDecl | UnspecifiedElement | diff --git a/swift/ql/test/extractor-tests/generated/decl/CapturedDecl/PrintAst.expected b/swift/ql/test/extractor-tests/generated/decl/CapturedDecl/PrintAst.expected index ac61ba1dfc60..689d93cab9b0 100644 --- a/swift/ql/test/extractor-tests/generated/decl/CapturedDecl/PrintAst.expected +++ b/swift/ql/test/extractor-tests/generated/decl/CapturedDecl/PrintAst.expected @@ -164,8 +164,8 @@ closures.swift: # 31| getArgument(0): [Argument] : ... .!=(_:_:) ... # 31| getExpr(): [BinaryExpr] ... .!=(_:_:) ... # 31| getFunction(): [MethodLookupExpr] .!=(_:_:) -# 31| getBase(): [TypeExpr] Optional.Type -# 31| getTypeRepr(): [TypeRepr] Optional +# 31| getBase(): [TypeExpr] Int?.Type +# 31| getTypeRepr(): [TypeRepr] Int? # 31| getMethodRef(): [DeclRefExpr] !=(_:_:) # 31| getArgument(0): [Argument] : x # 31| getExpr(): [DeclRefExpr] x diff --git a/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.expected b/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.expected index 09751f3c41d4..03460f83620a 100644 --- a/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.expected +++ b/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.expected @@ -118,11 +118,11 @@ getParentInitializer | var_decls.swift:57:36:57:36 | _w4 | var_decls.swift:57:4:57:41 | call to WrapperWithProjectedAndInit.init(wrappedValue:) | | var_decls.swift:57:36:57:36 | w4 | var_decls.swift:57:4:57:41 | call to WrapperWithProjectedAndInit.init(wrappedValue:) | getPropertyWrapperBackingVarBinding -| var_decls.swift:24:15:24:15 | wrapped | file://:0:0:0:0 | var ... = ... | -| var_decls.swift:54:10:54:10 | w1 | file://:0:0:0:0 | var ... = ... | -| var_decls.swift:55:24:55:24 | w2 | file://:0:0:0:0 | var ... = ... | -| var_decls.swift:56:29:56:29 | w3 | file://:0:0:0:0 | var ... = ... | -| var_decls.swift:57:36:57:36 | w4 | file://:0:0:0:0 | var ... = ... | +| var_decls.swift:24:15:24:15 | wrapped | var_decls.swift:24:15:24:15 | var ... = ... | +| var_decls.swift:54:10:54:10 | w1 | var_decls.swift:54:10:54:10 | var ... = ... | +| var_decls.swift:55:24:55:24 | w2 | var_decls.swift:55:24:55:24 | var ... = ... | +| var_decls.swift:56:29:56:29 | w3 | var_decls.swift:56:29:56:29 | var ... = ... | +| var_decls.swift:57:36:57:36 | w4 | var_decls.swift:57:36:57:36 | var ... = ... | getPropertyWrapperBackingVar | var_decls.swift:24:15:24:15 | wrapped | var_decls.swift:24:15:24:15 | _wrapped | | var_decls.swift:54:10:54:10 | w1 | var_decls.swift:54:10:54:10 | _w1 | @@ -130,8 +130,8 @@ getPropertyWrapperBackingVar | var_decls.swift:56:29:56:29 | w3 | var_decls.swift:56:29:56:29 | _w3 | | var_decls.swift:57:36:57:36 | w4 | var_decls.swift:57:36:57:36 | _w4 | getPropertyWrapperProjectionVarBinding -| var_decls.swift:56:29:56:29 | w3 | file://:0:0:0:0 | var ... = ... | -| var_decls.swift:57:36:57:36 | w4 | file://:0:0:0:0 | var ... = ... | +| var_decls.swift:56:29:56:29 | w3 | var_decls.swift:56:29:56:29 | var ... = ... | +| var_decls.swift:57:36:57:36 | w4 | var_decls.swift:57:36:57:36 | var ... = ... | getPropertyWrapperProjectionVar | var_decls.swift:56:29:56:29 | w3 | var_decls.swift:56:29:56:29 | $w3 | | var_decls.swift:57:36:57:36 | w4 | var_decls.swift:57:36:57:36 | $w4 | diff --git a/swift/ql/test/extractor-tests/generated/decl/MacroDecl/MacroRole.expected b/swift/ql/test/extractor-tests/generated/decl/MacroDecl/MacroRole.expected index 05232a3cd041..52e80f2a2c69 100644 --- a/swift/ql/test/extractor-tests/generated/decl/MacroDecl/MacroRole.expected +++ b/swift/ql/test/extractor-tests/generated/decl/MacroDecl/MacroRole.expected @@ -11,6 +11,7 @@ instances | file://:0:0:0:0 | #freestanding(expression) | getKind: | 1 | getMacroSyntax: | 0 | | file://:0:0:0:0 | #freestanding(expression) | getKind: | 1 | getMacroSyntax: | 0 | | file://:0:0:0:0 | @attached(accessor) | getKind: | 4 | getMacroSyntax: | 1 | +| file://:0:0:0:0 | @attached(extension) | getKind: | 256 | getMacroSyntax: | 1 | | file://:0:0:0:0 | @attached(member) | getKind: | 16 | getMacroSyntax: | 1 | | file://:0:0:0:0 | @attached(memberAttribute) | getKind: | 8 | getMacroSyntax: | 1 | | file://:0:0:0:0 | @attached(peer) | getKind: | 32 | getMacroSyntax: | 1 | @@ -22,6 +23,7 @@ instances | test.swift:6:2:6:20 | @attached(extension) | getKind: | 256 | getMacroSyntax: | 1 | getConformance getName +| file://:0:0:0:0 | @attached(extension) | 0 | _() | | file://:0:0:0:0 | @attached(peer) | 0 | $() | | file://:0:0:0:0 | @attached(peer) | 0 | _() | | file://:0:0:0:0 | @attached(peer) | 0 | _lldb_summary() | diff --git a/swift/ql/test/extractor-tests/generated/decl/ParamDecl/ParamDecl.expected b/swift/ql/test/extractor-tests/generated/decl/ParamDecl/ParamDecl.expected index f67d25dc31b0..65191e3d55f1 100644 --- a/swift/ql/test/extractor-tests/generated/decl/ParamDecl/ParamDecl.expected +++ b/swift/ql/test/extractor-tests/generated/decl/ParamDecl/ParamDecl.expected @@ -66,8 +66,8 @@ getAttachedPropertyWrapperType getParentPattern getParentInitializer getPropertyWrapperBackingVarBinding -| param_decls.swift:48:18:48:22 | p1 | file://:0:0:0:0 | var ... = ... | -| param_decls.swift:49:26:49:30 | p2 | file://:0:0:0:0 | var ... = ... | +| param_decls.swift:48:18:48:22 | p1 | param_decls.swift:48:18:48:18 | var ... = ... | +| param_decls.swift:49:26:49:30 | p2 | param_decls.swift:49:26:49:26 | var ... = ... | getPropertyWrapperBackingVar | param_decls.swift:48:18:48:22 | p1 | param_decls.swift:48:18:48:18 | _p1 | | param_decls.swift:49:26:49:30 | p2 | param_decls.swift:49:26:49:26 | _p2 | diff --git a/swift/ql/test/extractor-tests/generated/expr/ObjectLiteralExpr/ObjectLiteralExpr.expected b/swift/ql/test/extractor-tests/generated/expr/ObjectLiteralExpr/ObjectLiteralExpr.expected index abf317e5a3b9..9f454d9cd696 100644 --- a/swift/ql/test/extractor-tests/generated/expr/ObjectLiteralExpr/ObjectLiteralExpr.expected +++ b/swift/ql/test/extractor-tests/generated/expr/ObjectLiteralExpr/ObjectLiteralExpr.expected @@ -3,9 +3,9 @@ instances | object_literals.swift:6:5:6:61 | #colorLiteral(...) | getKind: | 2 | | object_literals.swift:7:5:7:44 | #imageLiteral(...) | getKind: | 1 | getType -| object_literals.swift:5:5:5:42 | #fileLiteral(...) | <> | -| object_literals.swift:6:5:6:61 | #colorLiteral(...) | <> | -| object_literals.swift:7:5:7:44 | #imageLiteral(...) | <> | +| object_literals.swift:5:5:5:42 | #fileLiteral(...) | _ | +| object_literals.swift:6:5:6:61 | #colorLiteral(...) | _ | +| object_literals.swift:7:5:7:44 | #imageLiteral(...) | _ | getArgument | object_literals.swift:5:5:5:42 | #fileLiteral(...) | 0 | object_literals.swift:5:18:5:32 | resourceName: file.txt | | object_literals.swift:6:5:6:61 | #colorLiteral(...) | 0 | object_literals.swift:6:19:6:24 | red: 255 | diff --git a/swift/ql/test/extractor-tests/generated/stmt/ForEachStmt/ForEachStmt.expected b/swift/ql/test/extractor-tests/generated/stmt/ForEachStmt/ForEachStmt.expected index 55fc86a8fdbd..ff575435d015 100644 --- a/swift/ql/test/extractor-tests/generated/stmt/ForEachStmt/ForEachStmt.expected +++ b/swift/ql/test/extractor-tests/generated/stmt/ForEachStmt/ForEachStmt.expected @@ -12,8 +12,8 @@ getVariable getWhere | for.swift:4:5:6:5 | for ... in ... where ... { ... } | for.swift:4:25:4:30 | ... .!=(_:_:) ... | getIteratorVar -| for.swift:4:5:6:5 | for ... in ... where ... { ... } | file://:0:0:0:0 | var ... = ... | -| for.swift:7:5:9:5 | for ... in ... { ... } | file://:0:0:0:0 | var ... = ... | +| for.swift:4:5:6:5 | for ... in ... where ... { ... } | for.swift:4:14:4:14 | var ... = ... | +| for.swift:7:5:9:5 | for ... in ... { ... } | for.swift:7:14:7:14 | var ... = ... | getNextCall | for.swift:4:5:6:5 | for ... in ... where ... { ... } | for.swift:4:5:4:5 | call to next() | | for.swift:7:5:9:5 | for ... in ... { ... } | for.swift:7:5:7:5 | call to next() | diff --git a/swift/ql/test/extractor-tests/generated/type/IntegerType/IntegerType.expected b/swift/ql/test/extractor-tests/generated/type/IntegerType/IntegerType.expected index 7fba23db8bdc..7b2c1bada262 100644 --- a/swift/ql/test/extractor-tests/generated/type/IntegerType/IntegerType.expected +++ b/swift/ql/test/extractor-tests/generated/type/IntegerType/IntegerType.expected @@ -1,2 +1,8 @@ +| 16 | getName: | 16 | getCanonicalType: | 16 | getValue: | 16 | +| 40 | getName: | 40 | getCanonicalType: | 40 | getValue: | 40 | +| 58 | getName: | 58 | getCanonicalType: | 58 | getValue: | 58 | +| 100 | getName: | 100 | getCanonicalType: | 100 | getValue: | 100 | +| 112 | getName: | 112 | getCanonicalType: | 112 | getValue: | 112 | | 128 | getName: | 128 | getCanonicalType: | 128 | getValue: | 128 | | 256 | getName: | 256 | getCanonicalType: | 256 | getValue: | 256 | +| 716 | getName: | 716 | getCanonicalType: | 716 | getValue: | 716 | diff --git a/swift/ql/test/library-tests/ast/PrintAst.expected b/swift/ql/test/library-tests/ast/PrintAst.expected index 8cd6a4a5aff7..9e47767c2376 100644 --- a/swift/ql/test/library-tests/ast/PrintAst.expected +++ b/swift/ql/test/library-tests/ast/PrintAst.expected @@ -705,7 +705,7 @@ cfg.swift: # 138| getVariable(0): [ConcreteVarDecl] $generator # 138| Type = IndexingIterator> # 138| getPattern(): [AnyPattern] _ -#-----| getIteratorVar(): [PatternBindingDecl] var ... = ... +# 138| getIteratorVar(): [PatternBindingDecl] var ... = ... # 138| getInit(0): [CallExpr] call to makeIterator() # 138| getFunction(): [MethodLookupExpr] .makeIterator() # 138| getBase(): [BinaryExpr] ... ....(_:_:) ... @@ -3263,7 +3263,7 @@ cfg.swift: # 526| getVariable(1): [ConcreteVarDecl] $i$generator # 526| Type = IndexingIterator> # 526| getPattern(): [NamedPattern] i -#-----| getIteratorVar(): [PatternBindingDecl] var ... = ... +# 526| getIteratorVar(): [PatternBindingDecl] var ... = ... # 526| getInit(0): [CallExpr] call to makeIterator() # 526| getFunction(): [MethodLookupExpr] .makeIterator() # 526| getBase(): [BinaryExpr] ... ....(_:_:) ... @@ -3302,7 +3302,7 @@ cfg.swift: # 533| getVariable(1): [ConcreteVarDecl] $i$generator # 533| Type = AsyncStream.Iterator # 533| getPattern(): [NamedPattern] i -#-----| getIteratorVar(): [PatternBindingDecl] var ... = ... +# 533| getIteratorVar(): [PatternBindingDecl] var ... = ... # 533| getInit(0): [CallExpr] call to makeAsyncIterator() # 533| getFunction(): [MethodLookupExpr] .makeAsyncIterator() # 533| getBase(): [DeclRefExpr] stream @@ -4141,7 +4141,7 @@ declarations.swift: #-----| getResult(): [MemberRefExpr] .wrappedValue #-----| getBase(): [DeclRefExpr] _x #-----| getCapture(0): [CapturedDecl] _x -#-----| getPropertyWrapperBackingVarBinding(): [PatternBindingDecl] var ... = ... +# 77| getPropertyWrapperBackingVarBinding(): [PatternBindingDecl] var ... = ... # 77| getInit(0): [CallExpr] call to ZeroWrapper.init() # 77| getFunction(): [MethodLookupExpr] ZeroWrapper.init() # 77| getBase(): [TypeExpr] ZeroWrapper.Type @@ -7018,7 +7018,7 @@ statements.swift: # 2| getVariable(1): [ConcreteVarDecl] $i$generator # 2| Type = IndexingIterator> # 2| getPattern(): [NamedPattern] i -#-----| getIteratorVar(): [PatternBindingDecl] var ... = ... +# 2| getIteratorVar(): [PatternBindingDecl] var ... = ... # 2| getInit(0): [CallExpr] call to makeIterator() # 2| getFunction(): [MethodLookupExpr] .makeIterator() # 2| getBase(): [BinaryExpr] ... ....(_:_:) ... @@ -7470,7 +7470,7 @@ statements.swift: # 71| getExpr(): [IntegerLiteralExpr] 2 # 71| getArgument(1): [Argument] : 0 # 71| getExpr(): [IntegerLiteralExpr] 0 -#-----| getIteratorVar(): [PatternBindingDecl] var ... = ... +# 71| getIteratorVar(): [PatternBindingDecl] var ... = ... # 71| getInit(0): [CallExpr] call to makeIterator() # 71| getFunction(): [MethodLookupExpr] .makeIterator() # 71| getBase(): [DeclRefExpr] numbers diff --git a/swift/ql/test/library-tests/controlflow/graph/Cfg.expected b/swift/ql/test/library-tests/controlflow/graph/Cfg.expected index 8fc8c7808b1b..f128a0994b53 100644 --- a/swift/ql/test/library-tests/controlflow/graph/Cfg.expected +++ b/swift/ql/test/library-tests/controlflow/graph/Cfg.expected @@ -474,7 +474,8 @@ | cfg.swift:138:12:138:12 | 0 | cfg.swift:138:16:138:16 | 10 | | | cfg.swift:138:12:138:12 | $generator | cfg.swift:138:12:138:12 | .makeIterator() | match | | cfg.swift:138:12:138:12 | .makeIterator() | cfg.swift:138:13:138:13 | ....(_:_:) | | -| cfg.swift:138:12:138:12 | call to makeIterator() | file://:0:0:0:0 | var ... = ... | | +| cfg.swift:138:12:138:12 | call to makeIterator() | cfg.swift:138:12:138:12 | var ... = ... | | +| cfg.swift:138:12:138:12 | var ... = ... | cfg.swift:138:3:138:3 | .next() | | | cfg.swift:138:12:138:16 | ... ....(_:_:) ... | cfg.swift:138:12:138:12 | call to makeIterator() | | | cfg.swift:138:13:138:13 | ....(_:_:) | cfg.swift:138:13:138:13 | Int.Type | | | cfg.swift:138:13:138:13 | Int.Type | cfg.swift:138:12:138:12 | 0 | | @@ -2023,7 +2024,8 @@ | cfg.swift:526:26:526:26 | 1 | cfg.swift:526:30:526:30 | 100 | | | cfg.swift:526:26:526:26 | $i$generator | cfg.swift:526:26:526:26 | .makeIterator() | match | | cfg.swift:526:26:526:26 | .makeIterator() | cfg.swift:526:27:526:27 | ....(_:_:) | | -| cfg.swift:526:26:526:26 | call to makeIterator() | file://:0:0:0:0 | var ... = ... | | +| cfg.swift:526:26:526:26 | call to makeIterator() | cfg.swift:526:26:526:26 | var ... = ... | | +| cfg.swift:526:26:526:26 | var ... = ... | cfg.swift:526:17:526:17 | .next() | | | cfg.swift:526:26:526:30 | ... ....(_:_:) ... | cfg.swift:526:26:526:26 | call to makeIterator() | | | cfg.swift:526:27:526:27 | ....(_:_:) | cfg.swift:526:27:526:27 | Int.Type | | | cfg.swift:526:27:526:27 | Int.Type | cfg.swift:526:26:526:26 | 1 | | @@ -2048,8 +2050,9 @@ | cfg.swift:533:24:533:24 | $i$generator | cfg.swift:533:24:533:24 | .makeAsyncIterator() | match | | cfg.swift:533:24:533:24 | (AsyncStream) ... | cfg.swift:533:24:533:24 | call to makeAsyncIterator() | | | cfg.swift:533:24:533:24 | .makeAsyncIterator() | cfg.swift:533:24:533:24 | stream | | -| cfg.swift:533:24:533:24 | call to makeAsyncIterator() | file://:0:0:0:0 | var ... = ... | | +| cfg.swift:533:24:533:24 | call to makeAsyncIterator() | cfg.swift:533:24:533:24 | var ... = ... | | | cfg.swift:533:24:533:24 | stream | cfg.swift:533:24:533:24 | (AsyncStream) ... | | +| cfg.swift:533:24:533:24 | var ... = ... | cfg.swift:533:5:533:5 | .next(isolation:) | | | cfg.swift:534:9:534:9 | print(_:separator:terminator:) | cfg.swift:534:15:534:15 | i | | | cfg.swift:534:9:534:16 | call to print(_:separator:terminator:) | cfg.swift:533:5:533:5 | .next(isolation:) | | | cfg.swift:534:14:534:14 | default separator | cfg.swift:534:14:534:14 | default terminator | | @@ -2350,6 +2353,3 @@ | file://:0:0:0:0 | value | file://:0:0:0:0 | ... = ... | | | file://:0:0:0:0 | value | file://:0:0:0:0 | ... = ... | | | file://:0:0:0:0 | value | file://:0:0:0:0 | ... = ... | | -| file://:0:0:0:0 | var ... = ... | cfg.swift:138:3:138:3 | .next() | | -| file://:0:0:0:0 | var ... = ... | cfg.swift:526:17:526:17 | .next() | | -| file://:0:0:0:0 | var ... = ... | cfg.swift:533:5:533:5 | .next(isolation:) | | diff --git a/swift/schema.py b/swift/schema.py index e7b45fb81a57..9302cb14b579 100644 --- a/swift/schema.py +++ b/swift/schema.py @@ -1480,7 +1480,14 @@ class TypeValueExpr(Expr): class IntegerType(Type): value: string -class BuiltinFixedArrayType(BuiltinType): +class BuiltinGenericType(BuiltinType): + """ + A builtin generic type. + """ + pass + + +class BuiltinFixedArrayType(BuiltinGenericType): """ A builtin type representing N values stored contiguously. """ diff --git a/swift/third_party/load.bzl b/swift/third_party/load.bzl index 676c5f0ce847..156a2201cdac 100644 --- a/swift/third_party/load.bzl +++ b/swift/third_party/load.bzl @@ -6,6 +6,10 @@ load("//misc/bazel:lfs.bzl", "lfs_archive", "lfs_files") _override = { # these are used to test new artifacts. Must be empty before merging to main + "swift-prebuilt-macOS-swift-6.3-RELEASE-161.tar.zst": "eab65167bfb20e07803b9be61b22b109a0308056c58b572ea9a275b920a3ea0a", + "swift-prebuilt-Linux-swift-6.3-RELEASE-161.tar.zst": "cfc111c983a00acfdb01090ba1f568fa257d2f8fc3050a2f7c37e160fe9f1003", + "resource-dir-macOS-swift-6.3-RELEASE-151.zip": "991e63a2559a762058d66df08275aea55217ff96bd482c5ad7d536181afa573a", + "resource-dir-Linux-swift-6.3-RELEASE-151.zip": "9078cfd1ec62f30cd25c0ea4e43fc3d99449f802e6c165f59a7f789a70eb5284", } _staging_url = "https://github.com/dsp-testing/codeql-swift-artifacts/releases/download/staging-{}/{}"