diff --git a/swift/ql/test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.expected b/swift/ql/test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.expected index dbbc1c70157ec..37ee373dc835b 100644 --- a/swift/ql/test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.expected +++ b/swift/ql/test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.expected @@ -1,3 +1,3 @@ -| file://:0:0:0:0 | Foo | getModule: | file://:0:0:0:0 | Foo | getNumberOfMembers: | 0 | getInterfaceType: | module | getName: | Foo | getNumberOfInheritedTypes: | 0 | isBuiltinModule: | no | isSystemModule: | no | getNumberOfImportedModules: | 4 | getNumberOfExportedModules: | 1 | +| file://:0:0:0:0 | Foo | getModule: | file://:0:0:0:0 | Foo | getNumberOfMembers: | 0 | getInterfaceType: | module | getName: | Foo | getNumberOfInheritedTypes: | 0 | isBuiltinModule: | no | isSystemModule: | no | getNumberOfImportedModules: | 5 | getNumberOfExportedModules: | 1 | | file://:0:0:0:0 | __ObjC | getModule: | file://:0:0:0:0 | __ObjC | getNumberOfMembers: | 0 | getInterfaceType: | module<__ObjC> | getName: | __ObjC | getNumberOfInheritedTypes: | 0 | isBuiltinModule: | no | isSystemModule: | no | getNumberOfImportedModules: | 1 | getNumberOfExportedModules: | 0 | -| file://:0:0:0:0 | default_module_name | getModule: | file://:0:0:0:0 | default_module_name | getNumberOfMembers: | 0 | getInterfaceType: | module | getName: | default_module_name | getNumberOfInheritedTypes: | 0 | isBuiltinModule: | no | isSystemModule: | no | getNumberOfImportedModules: | 4 | getNumberOfExportedModules: | 0 | +| file://:0:0:0:0 | default_module_name | getModule: | file://:0:0:0:0 | default_module_name | getNumberOfMembers: | 0 | getInterfaceType: | module | getName: | default_module_name | getNumberOfInheritedTypes: | 0 | isBuiltinModule: | no | isSystemModule: | no | getNumberOfImportedModules: | 5 | getNumberOfExportedModules: | 0 | diff --git a/swift/ql/test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl_getAnImportedModule.expected b/swift/ql/test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl_getAnImportedModule.expected index c711cd8b9132b..57f89e195bcea 100644 --- a/swift/ql/test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl_getAnImportedModule.expected +++ b/swift/ql/test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl_getAnImportedModule.expected @@ -2,8 +2,10 @@ | file://:0:0:0:0 | Foo | file://:0:0:0:0 | SwiftOnoneSupport | | file://:0:0:0:0 | Foo | file://:0:0:0:0 | _Concurrency | | file://:0:0:0:0 | Foo | file://:0:0:0:0 | _StringProcessing | +| file://:0:0:0:0 | Foo | file://:0:0:0:0 | _SwiftConcurrencyShims | | file://:0:0:0:0 | __ObjC | file://:0:0:0:0 | Swift | | file://:0:0:0:0 | default_module_name | file://:0:0:0:0 | Swift | | file://:0:0:0:0 | default_module_name | file://:0:0:0:0 | SwiftOnoneSupport | | file://:0:0:0:0 | default_module_name | file://:0:0:0:0 | _Concurrency | | file://:0:0:0:0 | default_module_name | file://:0:0:0:0 | _StringProcessing | +| file://:0:0:0:0 | default_module_name | file://:0:0:0:0 | _SwiftConcurrencyShims | diff --git a/swift/ql/test/extractor-tests/generated/expr/MethodLookupExpr/MethodLookupExpr_getMember.expected b/swift/ql/test/extractor-tests/generated/expr/MethodLookupExpr/MethodLookupExpr_getMember.expected index 0b599fe3fe326..a272e0da941f9 100644 --- a/swift/ql/test/extractor-tests/generated/expr/MethodLookupExpr/MethodLookupExpr_getMember.expected +++ b/swift/ql/test/extractor-tests/generated/expr/MethodLookupExpr/MethodLookupExpr_getMember.expected @@ -16,9 +16,9 @@ | method_lookups.swift:44:11:44:13 | .foo(_:_:) | method_lookups.swift:12:3:12:35 | foo(_:_:) | | method_lookups.swift:47:1:47:1 | Task.init(priority:operation:) | file://:0:0:0:0 | Task.init(priority:operation:) | | method_lookups.swift:48:9:48:11 | .foo(_:_:) | method_lookups.swift:22:3:22:35 | foo(_:_:) | -| method_lookups.swift:49:9:49:11 | .bar() | method_lookups.swift:23:3:23:21 | bar() | +| method_lookups.swift:49:9:49:11 | .bar() | method_lookups.swift:23:15:23:33 | bar() | | method_lookups.swift:50:9:50:9 | Z.init() | method_lookups.swift:26:3:28:3 | Z.init() | | method_lookups.swift:50:9:50:13 | .baz(_:) | method_lookups.swift:24:3:24:21 | baz(_:) | -| method_lookups.swift:52:11:52:13 | .bar() | method_lookups.swift:23:3:23:21 | bar() | +| method_lookups.swift:52:11:52:13 | .bar() | method_lookups.swift:23:15:23:33 | bar() | | method_lookups.swift:53:18:53:18 | Z.init() | method_lookups.swift:26:3:28:3 | Z.init() | | method_lookups.swift:53:23:53:23 | .baz(_:) | method_lookups.swift:24:3:24:21 | baz(_:) | diff --git a/swift/ql/test/extractor-tests/generated/expr/MethodLookupExpr/MethodLookupExpr_getType.expected b/swift/ql/test/extractor-tests/generated/expr/MethodLookupExpr/MethodLookupExpr_getType.expected index 689812463da90..61f37a4b9a9e9 100644 --- a/swift/ql/test/extractor-tests/generated/expr/MethodLookupExpr/MethodLookupExpr_getType.expected +++ b/swift/ql/test/extractor-tests/generated/expr/MethodLookupExpr/MethodLookupExpr_getType.expected @@ -20,7 +20,7 @@ | method_lookups.swift:44:11:44:13 | .foo(_:_:) | (Int, Int) -> () | | method_lookups.swift:47:1:47:1 | Task.init(priority:operation:) | (TaskPriority?, __owned @escaping @Sendable () async -> ()) -> Task<(), Never> | | method_lookups.swift:48:9:48:11 | .foo(_:_:) | @MainActor (Int, Int) -> () | -| method_lookups.swift:49:9:49:11 | .bar() | @MainActor () -> () | +| method_lookups.swift:49:9:49:11 | .bar() | () -> () | | method_lookups.swift:50:9:50:9 | Z.init() | @MainActor () -> Z | | method_lookups.swift:50:9:50:13 | .baz(_:) | @MainActor (Int) -> () | | method_lookups.swift:52:11:52:13 | .bar() | () -> () | diff --git a/swift/ql/test/extractor-tests/generated/expr/MethodLookupExpr/method_lookups.swift b/swift/ql/test/extractor-tests/generated/expr/MethodLookupExpr/method_lookups.swift index 5290eaae94d40..49c5673fbedb0 100644 --- a/swift/ql/test/extractor-tests/generated/expr/MethodLookupExpr/method_lookups.swift +++ b/swift/ql/test/extractor-tests/generated/expr/MethodLookupExpr/method_lookups.swift @@ -20,7 +20,7 @@ actor Y { @MainActor class Z { static func foo(_: Int, _:Int) {} - class func bar() {} + nonisolated class func bar() {} func baz(_: Int) {} init() { diff --git a/swift/ql/test/library-tests/ast/PrintAst.expected b/swift/ql/test/library-tests/ast/PrintAst.expected index c8dc0885e5317..1692e7f623265 100644 --- a/swift/ql/test/library-tests/ast/PrintAst.expected +++ b/swift/ql/test/library-tests/ast/PrintAst.expected @@ -3248,51 +3248,49 @@ cfg.swift: # 524| getParam(0): [ParamDecl] continuation # 524| Type = AsyncStream.Continuation # 523| getBody(): [BraceStmt] { ... } -# 525| getElement(0): [BraceStmt] { ... } -# 525| getElement(0): [CallExpr] call to detached(priority:operation:) -# 525| getFunction(): [MethodLookupExpr] .detached(priority:operation:) -# 525| getBase(): [TypeExpr] Task<(), Never>.Type -# 525| getTypeRepr(): [TypeRepr] Task<(), Never> -# 525| getMethodRef(): [DeclRefExpr] detached(priority:operation:) -# 525| getArgument(0): [Argument] priority: default priority -# 525| getExpr(): [DefaultArgumentExpr] default priority -# 525| getArgument(1): [Argument] operation: { ... } -# 525| getExpr(): [ExplicitClosureExpr] { ... } -# 525| getBody(): [BraceStmt] { ... } -# 526| getElement(0): [ForEachStmt] for ... in ... { ... } -# 526| getPattern(): [NamedPattern] i -#-----| getIteratorVar(): [PatternBindingDecl] var ... = ... -# 526| getInit(0): [CallExpr] call to makeIterator() -# 526| getFunction(): [MethodLookupExpr] .makeIterator() -# 526| getBase(): [BinaryExpr] ... ....(_:_:) ... -# 526| getFunction(): [MethodLookupExpr] ....(_:_:) -# 526| getBase(): [TypeExpr] Int.Type -# 526| getTypeRepr(): [TypeRepr] Int -# 526| getMethodRef(): [DeclRefExpr] ...(_:_:) -# 526| getArgument(0): [Argument] : 1 -# 526| getExpr(): [IntegerLiteralExpr] 1 -# 526| getArgument(1): [Argument] : 100 -# 526| getExpr(): [IntegerLiteralExpr] 100 -#-----| getMethodRef(): [DeclRefExpr] makeIterator() -# 526| getPattern(0): [NamedPattern] $i$generator -# 526| getNextCall(): [CallExpr] call to next() -# 526| getFunction(): [MethodLookupExpr] .next() -# 526| getBase(): [DeclRefExpr] $i$generator -# 526| getBase().getFullyConverted(): [InOutExpr] &... -#-----| getMethodRef(): [DeclRefExpr] next() -# 526| getBody(): [BraceStmt] { ... } -# 527| getElement(0): [CallExpr] call to yield(_:) -# 527| getFunction(): [MethodLookupExpr] .yield(_:) -# 527| getBase(): [DeclRefExpr] continuation -# 527| getMethodRef(): [DeclRefExpr] yield(_:) -# 527| getArgument(0): [Argument] : i -# 527| getExpr(): [DeclRefExpr] i -# 529| getElement(1): [CallExpr] call to finish() -# 529| getFunction(): [MethodLookupExpr] .finish() -# 529| getBase(): [DeclRefExpr] continuation -# 529| getMethodRef(): [DeclRefExpr] finish() -# 527| getCapture(0): [CapturedDecl] continuation -# 525| getElement(1): [ReturnStmt] return +# 525| getElement(0): [CallExpr] call to detached(priority:operation:) +# 525| getFunction(): [MethodLookupExpr] .detached(priority:operation:) +# 525| getBase(): [TypeExpr] Task<(), Never>.Type +# 525| getTypeRepr(): [TypeRepr] Task<(), Never> +# 525| getMethodRef(): [DeclRefExpr] detached(priority:operation:) +# 525| getArgument(0): [Argument] priority: default priority +# 525| getExpr(): [DefaultArgumentExpr] default priority +# 525| getArgument(1): [Argument] operation: { ... } +# 525| getExpr(): [ExplicitClosureExpr] { ... } +# 525| getBody(): [BraceStmt] { ... } +# 526| getElement(0): [ForEachStmt] for ... in ... { ... } +# 526| getPattern(): [NamedPattern] i +#-----| getIteratorVar(): [PatternBindingDecl] var ... = ... +# 526| getInit(0): [CallExpr] call to makeIterator() +# 526| getFunction(): [MethodLookupExpr] .makeIterator() +# 526| getBase(): [BinaryExpr] ... ....(_:_:) ... +# 526| getFunction(): [MethodLookupExpr] ....(_:_:) +# 526| getBase(): [TypeExpr] Int.Type +# 526| getTypeRepr(): [TypeRepr] Int +# 526| getMethodRef(): [DeclRefExpr] ...(_:_:) +# 526| getArgument(0): [Argument] : 1 +# 526| getExpr(): [IntegerLiteralExpr] 1 +# 526| getArgument(1): [Argument] : 100 +# 526| getExpr(): [IntegerLiteralExpr] 100 +#-----| getMethodRef(): [DeclRefExpr] makeIterator() +# 526| getPattern(0): [NamedPattern] $i$generator +# 526| getNextCall(): [CallExpr] call to next() +# 526| getFunction(): [MethodLookupExpr] .next() +# 526| getBase(): [DeclRefExpr] $i$generator +# 526| getBase().getFullyConverted(): [InOutExpr] &... +#-----| getMethodRef(): [DeclRefExpr] next() +# 526| getBody(): [BraceStmt] { ... } +# 527| getElement(0): [CallExpr] call to yield(_:) +# 527| getFunction(): [MethodLookupExpr] .yield(_:) +# 527| getBase(): [DeclRefExpr] continuation +# 527| getMethodRef(): [DeclRefExpr] yield(_:) +# 527| getArgument(0): [Argument] : i +# 527| getExpr(): [DeclRefExpr] i +# 529| getElement(1): [CallExpr] call to finish() +# 529| getFunction(): [MethodLookupExpr] .finish() +# 529| getBase(): [DeclRefExpr] continuation +# 529| getMethodRef(): [DeclRefExpr] finish() +# 527| getCapture(0): [CapturedDecl] continuation # 523| getPattern(0): [NamedPattern] stream # 533| getElement(1): [ForEachStmt] for ... in ... { ... } # 533| getPattern(): [NamedPattern] i diff --git a/swift/ql/test/library-tests/controlflow/graph/Cfg.expected b/swift/ql/test/library-tests/controlflow/graph/Cfg.expected index e1e160a6c3b91..56439ce6b539c 100644 --- a/swift/ql/test/library-tests/controlflow/graph/Cfg.expected +++ b/swift/ql/test/library-tests/controlflow/graph/Cfg.expected @@ -6077,14 +6077,11 @@ cfg.swift: # 525| Task<(), Never>.Type #-----| -> default priority -# 525| return -#-----| return -> exit { ... } (normal) - # 525| .detached(priority:operation:) #-----| -> Task<(), Never>.Type # 525| call to detached(priority:operation:) -#-----| -> return +#-----| -> exit { ... } (normal) # 525| default priority #-----| -> { ... } diff --git a/swift/ql/test/library-tests/elements/expr/methodlookup/PrintAst.expected b/swift/ql/test/library-tests/elements/expr/methodlookup/PrintAst.expected index b56ef3634a89d..d511a390341cb 100644 --- a/swift/ql/test/library-tests/elements/expr/methodlookup/PrintAst.expected +++ b/swift/ql/test/library-tests/elements/expr/methodlookup/PrintAst.expected @@ -226,7 +226,6 @@ methodlookup.swift: # 47| getFunction(): [MethodLookupExpr] .instanceMethod() # 47| getBase(): [DeclRefExpr] baz # 47| getMethodRef(): [DeclRefExpr] instanceMethod() -# 47| getMethodRef().getFullyConverted(): [FunctionConversionExpr] ((Baz) -> @MainActor () -> ()) ... # 47| getElement(2).getFullyConverted(): [AwaitExpr] await ... # 48| getElement(3): [CallExpr] call to { ... } # 48| getFunction(): [CallExpr] call to Baz.instanceMethod() diff --git a/swift/ql/test/library-tests/elements/expr/methodlookup/methodlookup.swift b/swift/ql/test/library-tests/elements/expr/methodlookup/methodlookup.swift index 5ba364ab0035c..9f382db9941ea 100644 --- a/swift/ql/test/library-tests/elements/expr/methodlookup/methodlookup.swift +++ b/swift/ql/test/library-tests/elements/expr/methodlookup/methodlookup.swift @@ -14,7 +14,7 @@ actor Bar { @MainActor class Baz { init() {} - func instanceMethod() {} + nonisolated func instanceMethod() {} static func staticMethod() {} class func classMethod() {} } diff --git a/swift/third_party/load.bzl b/swift/third_party/load.bzl index 7c8604e27b534..87deb10440136 100644 --- a/swift/third_party/load.bzl +++ b/swift/third_party/load.bzl @@ -1,14 +1,11 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") -# TODO: remove `remove-result-of.patch` once we update to a Swift version containing -# https://github.com/apple/swift/commit/2ed2cea2 -# (probably when updating to 5.9) -_swift_prebuilt_version = "swift-5.8.1-RELEASE.214" +_swift_prebuilt_version = "swift-5.9.1-RELEASE.255" _swift_sha_map = { - "Linux-X64": "009594131d2f6327e0033c4b7b0479a5730427575eb59a81a439fe0e343aa777", - "macOS-ARM64": "304a918e3699d404f57e967eff79b982388d8c5330c2135272c9f3a825920a39", - "macOS-X64": "c763c493e5782869b54887dc72df2aad00d59af7272c6d96377f1debb98741f2", + "Linux-X64": "0d5682d8acbe3ab81c2a0b8dc0dfadc0240895e28722cca6467d2ab71a69e004", + "macOS-ARM64": "ee53def6f89f97ce0882375121629d71fd87a673baa194f4c510920720d7bce6", + "macOS-X64": "61c2879ee89d6796f3b58fada8a5890756f5a8c053597f4faca019d660743d70", } _swift_arch_map = { @@ -29,7 +26,7 @@ _toolchain_info = { platform = "xcode", suffix = "osx", extension = "pkg", - sha = "417d46f73b2e6b5da82ebbc8a5f4979f7187691fd42119157ba56d5a8bc89eda", + sha = "fa4d3a67c4db8d63897e10d52903af40599cc351e8a73d6f5a4eb3cfd07c4605", ), } @@ -131,7 +128,6 @@ def load_dependencies(workspace_name): patches = [ "@%s//swift/third_party/swift-llvm-support:patches/%s.patch" % (workspace_name, patch_name) for patch_name in ( - "remove-result-of", "remove-redundant-operators", "add-constructor-to-Compilation", ) diff --git a/swift/third_party/swift-llvm-support/patches/remove-result-of.patch b/swift/third_party/swift-llvm-support/patches/remove-result-of.patch deleted file mode 100644 index ab3f2155b678e..0000000000000 --- a/swift/third_party/swift-llvm-support/patches/remove-result-of.patch +++ /dev/null @@ -1,30 +0,0 @@ -`std::result_of` was removed in C++20, but is still used in the Swift headers. We can't -remove it from there before prebuilding, as that is still done with C++14, but we can -replace it with `std::invoke_result` for compiling the extractor. - -diff --git a/include/swift/Basic/RelativePointer.h b/include/swift/Basic/RelativePointer.h -index 73f91262afa..bdaa304c804 100644 ---- a/include/swift/Basic/RelativePointer.h -+++ b/include/swift/Basic/RelativePointer.h -@@ -551,7 +551,7 @@ public: - } - - template -- typename std::result_of::type operator()(ArgTy... arg) const { -+ typename std::invoke_result::type operator()(ArgTy... arg) const { - #if SWIFT_PTRAUTH - void *ptr = this->super::getWithoutCast(); - return reinterpret_cast(ptrauth_sign_unauthenticated( -diff --git a/include/swift/Basic/STLExtras.h b/include/swift/Basic/STLExtras.h -index 7fa3d0c8890..6bc891a9b63 100644 ---- a/include/swift/Basic/STLExtras.h -+++ b/include/swift/Basic/STLExtras.h -@@ -405,7 +405,7 @@ class OptionalTransformIterator { - typename std::iterator_traits::reference; - - using ResultReference = -- typename std::result_of::type; -+ typename std::invoke_result::type; - - public: - /// Used to indicate when the current iterator has already been