Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/Compute/Attribute/AnyAttribute.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ func IAGGraphMutateAttribute(
_ attribute: AnyAttribute,
type: Metadata,
invalidating: Bool,
modify: (UnsafeMutableRawPointer) -> Void
modify: @escaping (UnsafeMutableRawPointer) -> Void
)

@_silgen_name("IAGGraphSearch")
func IAGGraphSearch(
attribute: AnyAttribute,
options: SearchOptions,
predicate: (AnyAttribute) -> Bool
predicate: @escaping (AnyAttribute) -> Bool
) -> Bool

extension AnyAttribute {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Compute/Attribute/AttributeType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extension String {

@_silgen_name("IAGRetainClosure")
func IAGRetainClosure(
_ closure: (UnsafeMutableRawPointer, AnyAttribute) -> Void
_ closure: @escaping (UnsafeMutableRawPointer, AnyAttribute) -> Void
) -> _IAGClosureStorage

extension _AttributeType {
Expand Down
6 changes: 4 additions & 2 deletions Sources/Compute/Attribute/RuleContext/AnyRuleContext.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ComputeCxx

@_silgen_name("IAGGraphWithUpdate")
func IAGGraphWithUpdate(_ attribute: AnyAttribute, body: () -> Void)
func IAGGraphWithUpdate(_ attribute: AnyAttribute, body: @escaping () -> Void)

@frozen
public struct AnyRuleContext {
Expand All @@ -21,7 +21,9 @@ public struct AnyRuleContext {
}

public func update(body: () -> Void) {
IAGGraphWithUpdate(attribute, body: body)
withoutActuallyEscaping(body) { escapingBody in
IAGGraphWithUpdate(attribute, body: escapingBody)
}
}

public func changedValue<Value>(
Expand Down
26 changes: 15 additions & 11 deletions Sources/Compute/Graph/Graph.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ extension Graph {
pointer.initialize(to: attributeType)
return UnsafePointer(pointer)
}
return internAttributeType(
ctx: ctx,
body: Metadata(body),
makeAttributeType: makeAttributeType
)
return withoutActuallyEscaping(makeAttributeType) { escapingMakeAttributeType in
return internAttributeType(
ctx: ctx,
body: Metadata(body),
makeAttributeType: escapingMakeAttributeType
)
}
}
}

Expand Down Expand Up @@ -81,7 +83,7 @@ func IAGGraphSetInvalidationCallback(
@_silgen_name("IAGGraphWithMainThreadHandler")
func IAGGraphWithMainThreadHandler(
_ graph: UnsafeRawPointer,
body: () -> Void,
body: @escaping () -> Void,
mainThreadHandler: (() -> Void) -> Void
)

Expand Down Expand Up @@ -118,11 +120,13 @@ extension Graph {
}

public func withMainThreadHandler(_ mainThreadHandler: (() -> Void) -> Void, do body: () -> Void) {
IAGGraphWithMainThreadHandler(
unsafeBitCast(self, to: UnsafeRawPointer.self),
body: body,
mainThreadHandler: mainThreadHandler
)
withoutActuallyEscaping(body) { escapingBody in
IAGGraphWithMainThreadHandler(
unsafeBitCast(self, to: UnsafeRawPointer.self),
body: escapingBody,
mainThreadHandler: mainThreadHandler
)
}
}
}

Expand Down
8 changes: 5 additions & 3 deletions Sources/Compute/Graph/Subgraph.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ComputeCxx
@_silgen_name("IAGSubgraphAddObserver")
func IAGSubgraphAddObserver(
_ subgraph: UnsafeRawPointer,
observer: () -> Void
observer: @escaping () -> Void
) -> Int

extension Subgraph {
Expand All @@ -16,7 +16,7 @@ extension Subgraph {
func IAGSubgraphApply(
_ subgraph: UnsafeRawPointer,
_ flags: Subgraph.Flags,
_ body: (AnyAttribute) -> Void
_ body: @escaping (AnyAttribute) -> Void
)

extension Subgraph {
Expand All @@ -36,7 +36,9 @@ extension Subgraph {
_ flags: Subgraph.Flags,
_ body: (AnyAttribute) -> Void
) {
IAGSubgraphApply(unsafeBitCast(self, to: UnsafeRawPointer.self), flags, body)
withoutActuallyEscaping(body) { escapingBody in
IAGSubgraphApply(unsafeBitCast(self, to: UnsafeRawPointer.self), flags, escapingBody)
}
}

}
Expand Down
9 changes: 6 additions & 3 deletions Sources/Compute/Runtime/Metadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public func forEachField(of type: Any.Type, do body: (UnsafePointer<Int8>, Int,
func IAGTypeApplyFields2(
_ type: Metadata,
options: Metadata.ApplyOptions,
body: (UnsafePointer<CChar>, Int, Metadata) -> Bool
body: @escaping (UnsafePointer<CChar>, Int, Metadata) -> Bool
) -> Bool

extension Metadata {
Expand All @@ -32,8 +32,11 @@ extension Metadata {
)
-> Bool
{
return IAGTypeApplyFields2(self, options: options) { fieldName, fieldOffset, fieldType in
return body(fieldName, fieldOffset, fieldType.type)
return withoutActuallyEscaping(body) { escapingBody in
let apply: (UnsafePointer<CChar>, Int, Metadata) -> Bool = { fieldName, fieldOffset, fieldType in
return escapingBody(fieldName, fieldOffset, fieldType.type)
}
return IAGTypeApplyFields2(self, options: options, body: apply)
}
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/ComputeCxx/Data/Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ vector<T>::iterator vector<T>::insert(zone *zone, const_iterator pos, const T &v
template <typename T>
vector<T>::iterator vector<T>::insert(zone *zone, const_iterator pos, T &&value) {
if (pos == end()) {
push_back(zone, value);
push_back(zone, std::move(value));
return end() - 1;
}
auto offset = pos - begin();
Expand Down
2 changes: 1 addition & 1 deletion Xcode/Configs/Compute.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ USE_HEADERMAP = NO
CODE_SIGN_STYLE = Automatic

CURRENT_PROJECT_VERSION = 1
MARKETING_VERSION = 0.5.2
MARKETING_VERSION = 0.6.1

ENABLE_MODULE_VERIFIER = YES
MODULE_VERIFIER_SUPPORTED_LANGUAGES = objective-c objective-c++
Expand Down
Loading