Просмотр исходного кода

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.
Thomas Van Lenten 6 лет назад
Родитель
Сommit
2af9c68591
2 измененных файлов с 42 добавлено и 42 удалено
  1. 22 22
      objectivec/GPBArray.h
  2. 20 20
      objectivec/GPBArray.m

+ 22 - 22
objectivec/GPBArray.h

@@ -134,7 +134,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **idx**:   The index of the current value.
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
-- (void)enumerateValuesWithBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
+- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
 
 
 /**
 /**
  * Enumerates the values on this array with the given block.
  * Enumerates the values on this array with the given block.
@@ -146,7 +146,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 - (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;
 
 
 /**
 /**
  * Adds a value to this array.
  * Adds a value to this array.
@@ -306,7 +306,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **idx**:   The index of the current value.
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
-- (void)enumerateValuesWithBlock:(void (^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
+- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
 
 
 /**
 /**
  * Enumerates the values on this array with the given block.
  * Enumerates the values on this array with the given block.
@@ -318,7 +318,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 - (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;
 
 
 /**
 /**
  * Adds a value to this array.
  * Adds a value to this array.
@@ -478,7 +478,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **idx**:   The index of the current value.
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
-- (void)enumerateValuesWithBlock:(void (^)(int64_t value, NSUInteger idx, BOOL *stop))block;
+- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int64_t value, NSUInteger idx, BOOL *stop))block;
 
 
 /**
 /**
  * Enumerates the values on this array with the given block.
  * Enumerates the values on this array with the given block.
@@ -490,7 +490,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 - (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;
 
 
 /**
 /**
  * Adds a value to this array.
  * Adds a value to this array.
@@ -650,7 +650,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **idx**:   The index of the current value.
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
-- (void)enumerateValuesWithBlock:(void (^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
+- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
 
 
 /**
 /**
  * Enumerates the values on this array with the given block.
  * Enumerates the values on this array with the given block.
@@ -662,7 +662,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 - (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;
 
 
 /**
 /**
  * Adds a value to this array.
  * Adds a value to this array.
@@ -822,7 +822,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **idx**:   The index of the current value.
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
-- (void)enumerateValuesWithBlock:(void (^)(float value, NSUInteger idx, BOOL *stop))block;
+- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx, BOOL *stop))block;
 
 
 /**
 /**
  * Enumerates the values on this array with the given block.
  * Enumerates the values on this array with the given block.
@@ -834,7 +834,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
-                        usingBlock:(void (^)(float value, NSUInteger idx, BOOL *stop))block;
+                        usingBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx, BOOL *stop))block;
 
 
 /**
 /**
  * Adds a value to this array.
  * Adds a value to this array.
@@ -994,7 +994,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **idx**:   The index of the current value.
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
-- (void)enumerateValuesWithBlock:(void (^)(double value, NSUInteger idx, BOOL *stop))block;
+- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx, BOOL *stop))block;
 
 
 /**
 /**
  * Enumerates the values on this array with the given block.
  * Enumerates the values on this array with the given block.
@@ -1006,7 +1006,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
-                        usingBlock:(void (^)(double value, NSUInteger idx, BOOL *stop))block;
+                        usingBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx, BOOL *stop))block;
 
 
 /**
 /**
  * Adds a value to this array.
  * Adds a value to this array.
@@ -1166,7 +1166,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **idx**:   The index of the current value.
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
-- (void)enumerateValuesWithBlock:(void (^)(BOOL value, NSUInteger idx, BOOL *stop))block;
+- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx, BOOL *stop))block;
 
 
 /**
 /**
  * Enumerates the values on this array with the given block.
  * Enumerates the values on this array with the given block.
@@ -1178,7 +1178,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
-                        usingBlock:(void (^)(BOOL value, NSUInteger idx, BOOL *stop))block;
+                        usingBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx, BOOL *stop))block;
 
 
 /**
 /**
  * Adds a value to this array.
  * Adds a value to this array.
@@ -1369,7 +1369,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **idx**:   The index of the current value.
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
-- (void)enumerateValuesWithBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
+- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
 
 
 /**
 /**
  * Enumerates the values on this array with the given block.
  * Enumerates the values on this array with the given block.
@@ -1381,7 +1381,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 - (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;
 
 
 // These methods bypass the validationFunc to provide access to values that were not
 // These methods bypass the validationFunc to provide access to values that were not
 // known at the time the binary was compiled.
 // known at the time the binary was compiled.
@@ -1403,7 +1403,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **idx**:   The index of the current value.
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
-- (void)enumerateRawValuesWithBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
+- (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
 
 
 /**
 /**
  * Enumerates the values on this array with the given block.
  * Enumerates the values on this array with the given block.
@@ -1415,7 +1415,7 @@ NS_ASSUME_NONNULL_BEGIN
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
  **/
 - (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
 - (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;
 
 
 // If value is not a valid enumerator as defined by validationFunc, these
 // If value is not a valid enumerator as defined by validationFunc, these
 // methods will assert in debug, and will log in release and assign the value
 // methods will assert in debug, and will log in release and assign the value
@@ -1779,7 +1779,7 @@ NS_ASSUME_NONNULL_END
 //% *   **idx**:   The index of the current value.
 //% *   **idx**:   The index of the current value.
 //% *   **stop**:  A pointer to a boolean that when set stops the enumeration.
 //% *   **stop**:  A pointer to a boolean that when set stops the enumeration.
 //% **/
 //% **/
-//%- (void)enumerateRawValuesWithBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block;
+//%- (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
 //%
 //%
 //%/**
 //%/**
 //% * Enumerates the values on this array with the given block.
 //% * Enumerates the values on this array with the given block.
@@ -1791,7 +1791,7 @@ NS_ASSUME_NONNULL_END
 //% *   **stop**:  A pointer to a boolean that when set stops the enumeration.
 //% *   **stop**:  A pointer to a boolean that when set stops the enumeration.
 //% **/
 //% **/
 //%- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
 //%- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
-//%                           usingBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block;
+//%                           usingBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
 //%
 //%
 //%// If value is not a valid enumerator as defined by validationFunc, these
 //%// If value is not a valid enumerator as defined by validationFunc, these
 //%// methods will assert in debug, and will log in release and assign the value
 //%// methods will assert in debug, and will log in release and assign the value
@@ -1821,7 +1821,7 @@ NS_ASSUME_NONNULL_END
 //% *   **idx**:   The index of the current value.
 //% *   **idx**:   The index of the current value.
 //% *   **stop**:  A pointer to a boolean that when set stops the enumeration.
 //% *   **stop**:  A pointer to a boolean that when set stops the enumeration.
 //% **/
 //% **/
-//%- (void)enumerateValuesWithBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block;
+//%- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
 //%
 //%
 //%/**
 //%/**
 //% * Enumerates the values on this array with the given block.
 //% * Enumerates the values on this array with the given block.
@@ -1833,7 +1833,7 @@ NS_ASSUME_NONNULL_END
 //% *   **stop**:  A pointer to a boolean that when set stops the enumeration.
 //% *   **stop**:  A pointer to a boolean that when set stops the enumeration.
 //% **/
 //% **/
 //%- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 //%- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
-//%                        usingBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block;
+//%                        usingBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
 
 
 //%PDDM-DEFINE ARRAY_MUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
 //%PDDM-DEFINE ARRAY_MUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
 //%/**
 //%/**

+ 20 - 20
objectivec/GPBArray.m

@@ -194,12 +194,12 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
 //%  return result;
 //%  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];
 //%  [self enumerate##ACCESSOR_NAME##ValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
 //%}
 //%}
 //%
 //%
 //%- (void)enumerate##ACCESSOR_NAME##ValuesWithOptions:(NSEnumerationOptions)opts
 //%- (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).
 //%  // NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
 //%  BOOL stop = NO;
 //%  BOOL stop = NO;
 //%  if ((opts & NSEnumerationReverse) == 0) {
 //%  if ((opts & NSEnumerationReverse) == 0) {
@@ -405,12 +405,12 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
   return result;
   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];
   [self enumerateValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
 }
 }
 
 
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 - (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).
   // NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
   BOOL stop = NO;
   BOOL stop = NO;
   if ((opts & NSEnumerationReverse) == 0) {
   if ((opts & NSEnumerationReverse) == 0) {
@@ -653,12 +653,12 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
   return result;
   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];
   [self enumerateValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
 }
 }
 
 
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 - (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).
   // NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
   BOOL stop = NO;
   BOOL stop = NO;
   if ((opts & NSEnumerationReverse) == 0) {
   if ((opts & NSEnumerationReverse) == 0) {
@@ -901,12 +901,12 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
   return result;
   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];
   [self enumerateValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
 }
 }
 
 
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 - (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).
   // NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
   BOOL stop = NO;
   BOOL stop = NO;
   if ((opts & NSEnumerationReverse) == 0) {
   if ((opts & NSEnumerationReverse) == 0) {
@@ -1149,12 +1149,12 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
   return result;
   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];
   [self enumerateValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
 }
 }
 
 
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 - (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).
   // NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
   BOOL stop = NO;
   BOOL stop = NO;
   if ((opts & NSEnumerationReverse) == 0) {
   if ((opts & NSEnumerationReverse) == 0) {
@@ -1397,12 +1397,12 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
   return result;
   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];
   [self enumerateValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
 }
 }
 
 
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 - (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).
   // NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
   BOOL stop = NO;
   BOOL stop = NO;
   if ((opts & NSEnumerationReverse) == 0) {
   if ((opts & NSEnumerationReverse) == 0) {
@@ -1645,12 +1645,12 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
   return result;
   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];
   [self enumerateValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
 }
 }
 
 
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 - (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).
   // NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
   BOOL stop = NO;
   BOOL stop = NO;
   if ((opts & NSEnumerationReverse) == 0) {
   if ((opts & NSEnumerationReverse) == 0) {
@@ -1893,12 +1893,12 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
   return result;
   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];
   [self enumerateValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
 }
 }
 
 
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 - (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).
   // NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
   BOOL stop = NO;
   BOOL stop = NO;
   if ((opts & NSEnumerationReverse) == 0) {
   if ((opts & NSEnumerationReverse) == 0) {
@@ -2165,12 +2165,12 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
   return result;
   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];
   [self enumerateRawValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
 }
 }
 
 
 - (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
 - (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).
   // NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
   BOOL stop = NO;
   BOOL stop = NO;
   if ((opts & NSEnumerationReverse) == 0) {
   if ((opts & NSEnumerationReverse) == 0) {
@@ -2217,12 +2217,12 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
   return _values[index];
   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];
   [self enumerateValuesWithOptions:(NSEnumerationOptions)0 usingBlock:block];
 }
 }
 
 
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
 - (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).
   // NSEnumerationConcurrent isn't currently supported (and Apple's docs say that is ok).
   BOOL stop = NO;
   BOOL stop = NO;
   GPBEnumValidationFunc func = _validationFunc;
   GPBEnumValidationFunc func = _validationFunc;