Annotate the GPBArray enumerate* apis with NS_NOESCAPE.
This should help the Swift compiler if these apis are used because it
changes the codegen to not need copies/retains.
diff --git a/objectivec/GPBArray.m b/objectivec/GPBArray.m
index 122e030..5ce1e59 100644
--- a/objectivec/GPBArray.m
+++ b/objectivec/GPBArray.m
@@ -194,12 +194,12 @@
//% return result;
//%}
//%
-//%- (void)enumerate##ACCESSOR_NAME##ValuesWithBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block {
+//%- (void)enumerate##ACCESSOR_NAME##ValuesWithBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block {
//% [self enumerate##ACCESSOR_NAME##ValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
//%}
//%
//%- (void)enumerate##ACCESSOR_NAME##ValuesWithOptions:(NSEnumerationOptions)opts
-//% ACCESSOR_NAME$S usingBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block {
+//% ACCESSOR_NAME$S usingBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block {
//% // NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
//% BOOL stop = NO;
//% if ((opts & NSEnumerationReverse) == 0) {
@@ -405,12 +405,12 @@
return result;
}
-- (void)enumerateValuesWithBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block {
+- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block {
[self enumerateValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
}
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
- usingBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block {
+ usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block {
// NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
BOOL stop = NO;
if ((opts & NSEnumerationReverse) == 0) {
@@ -653,12 +653,12 @@
return result;
}
-- (void)enumerateValuesWithBlock:(void (^)(uint32_t value, NSUInteger idx, BOOL *stop))block {
+- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(uint32_t value, NSUInteger idx, BOOL *stop))block {
[self enumerateValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
}
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
- usingBlock:(void (^)(uint32_t value, NSUInteger idx, BOOL *stop))block {
+ usingBlock:(void (NS_NOESCAPE ^)(uint32_t value, NSUInteger idx, BOOL *stop))block {
// NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
BOOL stop = NO;
if ((opts & NSEnumerationReverse) == 0) {
@@ -901,12 +901,12 @@
return result;
}
-- (void)enumerateValuesWithBlock:(void (^)(int64_t value, NSUInteger idx, BOOL *stop))block {
+- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int64_t value, NSUInteger idx, BOOL *stop))block {
[self enumerateValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
}
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
- usingBlock:(void (^)(int64_t value, NSUInteger idx, BOOL *stop))block {
+ usingBlock:(void (NS_NOESCAPE ^)(int64_t value, NSUInteger idx, BOOL *stop))block {
// NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
BOOL stop = NO;
if ((opts & NSEnumerationReverse) == 0) {
@@ -1149,12 +1149,12 @@
return result;
}
-- (void)enumerateValuesWithBlock:(void (^)(uint64_t value, NSUInteger idx, BOOL *stop))block {
+- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(uint64_t value, NSUInteger idx, BOOL *stop))block {
[self enumerateValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
}
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
- usingBlock:(void (^)(uint64_t value, NSUInteger idx, BOOL *stop))block {
+ usingBlock:(void (NS_NOESCAPE ^)(uint64_t value, NSUInteger idx, BOOL *stop))block {
// NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
BOOL stop = NO;
if ((opts & NSEnumerationReverse) == 0) {
@@ -1397,12 +1397,12 @@
return result;
}
-- (void)enumerateValuesWithBlock:(void (^)(float value, NSUInteger idx, BOOL *stop))block {
+- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx, BOOL *stop))block {
[self enumerateValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
}
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
- usingBlock:(void (^)(float value, NSUInteger idx, BOOL *stop))block {
+ usingBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx, BOOL *stop))block {
// NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
BOOL stop = NO;
if ((opts & NSEnumerationReverse) == 0) {
@@ -1645,12 +1645,12 @@
return result;
}
-- (void)enumerateValuesWithBlock:(void (^)(double value, NSUInteger idx, BOOL *stop))block {
+- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx, BOOL *stop))block {
[self enumerateValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
}
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
- usingBlock:(void (^)(double value, NSUInteger idx, BOOL *stop))block {
+ usingBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx, BOOL *stop))block {
// NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
BOOL stop = NO;
if ((opts & NSEnumerationReverse) == 0) {
@@ -1893,12 +1893,12 @@
return result;
}
-- (void)enumerateValuesWithBlock:(void (^)(BOOL value, NSUInteger idx, BOOL *stop))block {
+- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx, BOOL *stop))block {
[self enumerateValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
}
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
- usingBlock:(void (^)(BOOL value, NSUInteger idx, BOOL *stop))block {
+ usingBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx, BOOL *stop))block {
// NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
BOOL stop = NO;
if ((opts & NSEnumerationReverse) == 0) {
@@ -2165,12 +2165,12 @@
return result;
}
-- (void)enumerateRawValuesWithBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block {
+- (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block {
[self enumerateRawValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
}
- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
- usingBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block {
+ usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block {
// NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
BOOL stop = NO;
if ((opts & NSEnumerationReverse) == 0) {
@@ -2217,12 +2217,12 @@
return _values[index];
}
-- (void)enumerateValuesWithBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block {
+- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block {
[self enumerateValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
}
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
- usingBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block {
+ usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block {
// NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
BOOL stop = NO;
GPBEnumValidationFunc func = _validationFunc;