[ObjC] Tweak some things to be better shape for clang-format.

- Minor formatting changes to make thing happy.
- Block clang-format from the PDDM macro definitions to avoid it wrapping
  things.
- Don't add clang-format directives to the expansion, easier to handling
  it outside of there.
diff --git a/objectivec/DevTools/pddm.py b/objectivec/DevTools/pddm.py
index 60ff089..11925b1 100755
--- a/objectivec/DevTools/pddm.py
+++ b/objectivec/DevTools/pddm.py
@@ -485,14 +485,13 @@
         if self._macro_collection:
           # Always add a blank line, seems to read better. (If need be, add an
           # option to the EXPAND to indicate if this should be done.)
-          result.extend([_GENERATED_CODE_LINE, '// clang-format off', ''])
+          result.extend([_GENERATED_CODE_LINE, ''])
           macro = line[directive_len:].strip()
           try:
             expand_result = self._macro_collection.Expand(macro)
             # Since expansions are line oriented, strip trailing whitespace
             # from the lines.
             lines = [x.rstrip() for x in expand_result.split('\n')]
-            lines.append('// clang-format on')
             result.append('\n'.join(lines))
           except PDDMError as e:
             raise PDDMError('%s\n...while expanding "%s" from the section'
diff --git a/objectivec/DevTools/pddm_tests.py b/objectivec/DevTools/pddm_tests.py
index d5b88c9..2d9c47f 100755
--- a/objectivec/DevTools/pddm_tests.py
+++ b/objectivec/DevTools/pddm_tests.py
@@ -418,24 +418,18 @@
 foo
 //%PDDM-EXPAND mumble(abc)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 abc: doAbc(int abc);
-// clang-format on
 //%PDDM-EXPAND-END mumble(abc)
 bar
 //%PDDM-EXPAND mumble(def)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 def: doDef(int def);
-// clang-format on
 //%PDDM-EXPAND mumble(ghi)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 ghi: doGhi(int ghi);
-// clang-format on
 //%PDDM-EXPAND-END (2 expansions)
 baz
 //%PDDM-DEFINE mumble(a_)
diff --git a/objectivec/GPBArray.h b/objectivec/GPBArray.h
index 5aea75c..4985dbe 100644
--- a/objectivec/GPBArray.h
+++ b/objectivec/GPBArray.h
@@ -34,9 +34,11 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-EXPAND DECLARE_ARRAYS()
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Int32
 
@@ -135,7 +137,8 @@
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
-- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(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.
@@ -147,7 +150,8 @@
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
-                        usingBlock:(void (NS_NOESCAPE ^)(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.
@@ -307,7 +311,8 @@
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
-- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(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.
@@ -319,7 +324,8 @@
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
-                        usingBlock:(void (NS_NOESCAPE ^)(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.
@@ -479,7 +485,8 @@
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
-- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(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.
@@ -491,7 +498,8 @@
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
-                        usingBlock:(void (NS_NOESCAPE ^)(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.
@@ -651,7 +659,8 @@
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
-- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(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.
@@ -663,7 +672,8 @@
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
-                        usingBlock:(void (NS_NOESCAPE ^)(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.
@@ -823,7 +833,8 @@
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
-- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(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.
@@ -835,7 +846,8 @@
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
-                        usingBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx, BOOL *stop))block;
+                        usingBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx,
+                                                         BOOL *stop))block;
 
 /**
  * Adds a value to this array.
@@ -995,7 +1007,8 @@
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
-- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(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.
@@ -1007,7 +1020,8 @@
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
-                        usingBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx, BOOL *stop))block;
+                        usingBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx,
+                                                         BOOL *stop))block;
 
 /**
  * Adds a value to this array.
@@ -1167,7 +1181,8 @@
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
-- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(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.
@@ -1179,7 +1194,8 @@
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
-                        usingBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx, BOOL *stop))block;
+                        usingBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx,
+                                                         BOOL *stop))block;
 
 /**
  * Adds a value to this array.
@@ -1370,7 +1386,8 @@
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
-- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(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.
@@ -1382,7 +1399,8 @@
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
-                        usingBlock:(void (NS_NOESCAPE ^)(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
 // known at the time the binary was compiled.
@@ -1404,7 +1422,8 @@
  *   **idx**:   The index of the current value.
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
-- (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(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.
@@ -1416,7 +1435,8 @@
  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
  **/
 - (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
-                           usingBlock:(void (NS_NOESCAPE ^)(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
 // methods will assert in debug, and will log in release and assign the value
@@ -1536,7 +1556,6 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND-END DECLARE_ARRAYS()
 
 NS_ASSUME_NONNULL_END
@@ -1781,7 +1800,8 @@
 //% *   **idx**:   The index of the current value.
 //% *   **stop**:  A pointer to a boolean that when set stops the enumeration.
 //% **/
-//%- (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(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.
@@ -1793,7 +1813,8 @@
 //% *   **stop**:  A pointer to a boolean that when set stops the enumeration.
 //% **/
 //%- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
-//%                           usingBlock:(void (NS_NOESCAPE ^)(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
 //%// methods will assert in debug, and will log in release and assign the value
@@ -1823,7 +1844,8 @@
 //% *   **idx**:   The index of the current value.
 //% *   **stop**:  A pointer to a boolean that when set stops the enumeration.
 //% **/
-//%- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(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.
@@ -1835,7 +1857,8 @@
 //% *   **stop**:  A pointer to a boolean that when set stops the enumeration.
 //% **/
 //%- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
-//%                        usingBlock:(void (NS_NOESCAPE ^)(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)
 //%/**
@@ -1967,3 +1990,5 @@
 //%
 //%// No validation applies to these methods.
 //%
+
+// clang-format on
diff --git a/objectivec/GPBArray.m b/objectivec/GPBArray.m
index bb9a077..1db7a8f 100644
--- a/objectivec/GPBArray.m
+++ b/objectivec/GPBArray.m
@@ -47,6 +47,9 @@
   return (value != kGPBUnrecognizedEnumeratorValue);
 }
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-DEFINE VALIDATE_RANGE(INDEX, COUNT)
 //%  if (INDEX >= COUNT) {
 //%    [NSException raise:NSRangeException
@@ -194,12 +197,12 @@
 //%  return result;
 //%}
 //%
-//%- (void)enumerate##ACCESSOR_NAME##ValuesWithBlock:(void (NS_NOESCAPE ^)(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 (NS_NOESCAPE ^)(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) {
@@ -292,10 +295,8 @@
 //%  _values[idx2] = temp;
 //%}
 //%
-
 //%PDDM-EXPAND ARRAY_INTERFACE_SIMPLE(Int32, int32_t, %d)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Int32
 
@@ -406,12 +407,12 @@
   return result;
 }
 
-- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(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 (NS_NOESCAPE ^)(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) {
@@ -542,10 +543,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND ARRAY_INTERFACE_SIMPLE(UInt32, uint32_t, %u)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - UInt32
 
@@ -656,12 +655,12 @@
   return result;
 }
 
-- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(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 (NS_NOESCAPE ^)(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) {
@@ -792,10 +791,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND ARRAY_INTERFACE_SIMPLE(Int64, int64_t, %lld)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Int64
 
@@ -906,12 +903,12 @@
   return result;
 }
 
-- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(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 (NS_NOESCAPE ^)(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) {
@@ -1042,10 +1039,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND ARRAY_INTERFACE_SIMPLE(UInt64, uint64_t, %llu)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - UInt64
 
@@ -1156,12 +1151,12 @@
   return result;
 }
 
-- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(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 (NS_NOESCAPE ^)(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) {
@@ -1292,10 +1287,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND ARRAY_INTERFACE_SIMPLE(Float, float, %f)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Float
 
@@ -1406,12 +1399,12 @@
   return result;
 }
 
-- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(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 (NS_NOESCAPE ^)(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) {
@@ -1542,10 +1535,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND ARRAY_INTERFACE_SIMPLE(Double, double, %lf)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Double
 
@@ -1656,12 +1647,12 @@
   return result;
 }
 
-- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(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 (NS_NOESCAPE ^)(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) {
@@ -1792,10 +1783,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND ARRAY_INTERFACE_SIMPLE(Bool, BOOL, %d)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool
 
@@ -1906,12 +1895,12 @@
   return result;
 }
 
-- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(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 (NS_NOESCAPE ^)(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) {
@@ -2042,9 +2031,10 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND-END (7 expansions)
 
+// clang-format on
+
 #pragma mark - Enum
 
 @implementation GPBEnumArray {
@@ -2138,9 +2128,11 @@
                                   count:_count];
 }
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-EXPAND ARRAY_IMMUTABLE_CORE(Enum, int32_t, Raw, %d)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)dealloc {
   NSAssert(!_autocreator,
@@ -2180,12 +2172,12 @@
   return result;
 }
 
-- (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(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 (NS_NOESCAPE ^)(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) {
@@ -2200,21 +2192,22 @@
     }
   }
 }
-// clang-format on
 //%PDDM-EXPAND-END ARRAY_IMMUTABLE_CORE(Enum, int32_t, Raw, %d)
 
+// clang-format on
+
 - (int32_t)valueAtIndex:(NSUInteger)index {
+// clang-format off
 //%PDDM-EXPAND VALIDATE_RANGE(index, _count)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   if (index >= _count) {
     [NSException raise:NSRangeException
                 format:@"Index (%lu) beyond bounds (%lu)",
                        (unsigned long)index, (unsigned long)_count];
   }
-// clang-format on
 //%PDDM-EXPAND-END VALIDATE_RANGE(index, _count)
+// clang-format on
   int32_t result = _values[index];
   if (!_validationFunc(result)) {
     result = kGPBUnrecognizedEnumeratorValue;
@@ -2223,17 +2216,17 @@
 }
 
 - (int32_t)rawValueAtIndex:(NSUInteger)index {
+// clang-format off
 //%PDDM-EXPAND VALIDATE_RANGE(index, _count)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   if (index >= _count) {
     [NSException raise:NSRangeException
                 format:@"Index (%lu) beyond bounds (%lu)",
                        (unsigned long)index, (unsigned long)_count];
   }
-// clang-format on
 //%PDDM-EXPAND-END VALIDATE_RANGE(index, _count)
+// clang-format on
   return _values[index];
 }
 
@@ -2271,9 +2264,10 @@
   }
 }
 
+// clang-format off
+
 //%PDDM-EXPAND ARRAY_MUTABLE_CORE(Enum, int32_t, Raw, %d)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)internalResizeToCapacity:(NSUInteger)newCapacity {
   _values = reallocf(_values, newCapacity * sizeof(int32_t));
@@ -2379,10 +2373,8 @@
   _values[idx2] = temp;
 }
 
-// clang-format on
 //%PDDM-EXPAND MUTATION_METHODS(Enum, int32_t, , EnumValidationList, EnumValidationOne)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)addValue:(int32_t)value {
   [self addValues:&value count:1];
@@ -2449,7 +2441,6 @@
   }
   _values[index] = value;
 }
-// clang-format on
 //%PDDM-EXPAND-END (2 expansions)
 
 //%PDDM-DEFINE MUTATION_HOOK_EnumValidationList()
@@ -2470,6 +2461,8 @@
 //%  }
 //%
 
+// clang-format on
+
 @end
 
 #pragma mark - NSArray Subclass
@@ -2556,17 +2549,17 @@
 }
 
 - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
-                                  objects:(id __unsafe_unretained [])buffer
+                                  objects:(id __unsafe_unretained[])buffer
                                     count:(NSUInteger)len {
   return [_array countByEnumeratingWithState:state objects:buffer count:len];
 }
 
-- (void)enumerateObjectsUsingBlock:(void (NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))block {
+- (void)enumerateObjectsUsingBlock:(void(NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))block {
   [_array enumerateObjectsUsingBlock:block];
 }
 
 - (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts
-                         usingBlock:(void (NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))block {
+                         usingBlock:(void(NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))block {
   [_array enumerateObjectsWithOptions:opts usingBlock:block];
 }
 
diff --git a/objectivec/GPBArray_PackagePrivate.h b/objectivec/GPBArray_PackagePrivate.h
index 07eab89..35a4538 100644
--- a/objectivec/GPBArray_PackagePrivate.h
+++ b/objectivec/GPBArray_PackagePrivate.h
@@ -54,7 +54,6 @@
 
 //%PDDM-EXPAND DECLARE_ARRAY_EXTRAS()
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Int32
 
@@ -120,7 +119,6 @@
 }
 @end
 
-// clang-format on
 //%PDDM-EXPAND-END DECLARE_ARRAY_EXTRAS()
 
 #pragma mark - NSArray Subclass
diff --git a/objectivec/GPBCodedOutputStream.h b/objectivec/GPBCodedOutputStream.h
index 5dde974..304a24e 100644
--- a/objectivec/GPBCodedOutputStream.h
+++ b/objectivec/GPBCodedOutputStream.h
@@ -171,13 +171,13 @@
  * @param offset The offset into the blob to start writing out.
  * @param length The number of bytes from the blob to write out.
  **/
-- (void)writeRawPtr:(const void *)data
-             offset:(size_t)offset
-             length:(size_t)length;
+- (void)writeRawPtr:(const void *)data offset:(size_t)offset length:(size_t)length;
+
+// Disable clang-format for the macros.
+// clang-format off
 
 //%PDDM-EXPAND _WRITE_DECLS()
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 /**
  * Write a double for the given field number.
@@ -631,9 +631,10 @@
 - (void)writeUnknownGroupNoTag:(int32_t)fieldNumber
                          value:(GPBUnknownFieldSet *)value;
 
-// clang-format on
 //%PDDM-EXPAND-END _WRITE_DECLS()
 
+// clang-format on
+
 /**
 Write a MessageSet extension field to the stream. For historical reasons,
 the wire format differs from normal fields.
@@ -656,6 +657,9 @@
 
 NS_ASSUME_NONNULL_END
 
+// Disable clang-format for the macros.
+// clang-format off
+
 // Write methods for types that can be in packed arrays.
 //%PDDM-DEFINE _WRITE_PACKABLE_DECLS(NAME, ARRAY_TYPE, TYPE)
 //%/**
@@ -755,3 +759,5 @@
 //%_WRITE_UNPACKABLE_DECLS(Bytes, NSData)
 //%_WRITE_GROUP_DECLS(Group, GPBMessage)
 //%_WRITE_GROUP_DECLS(UnknownGroup, GPBUnknownFieldSet)
+
+// clang-format on
diff --git a/objectivec/GPBCodedOutputStream.m b/objectivec/GPBCodedOutputStream.m
index 4e2a514..5a147aa 100644
--- a/objectivec/GPBCodedOutputStream.m
+++ b/objectivec/GPBCodedOutputStream.m
@@ -418,6 +418,8 @@
   GPBWriteRawVarint64(&state_, GPBEncodeZigZag64(value));
 }
 
+// clang-format off
+
 //%PDDM-DEFINE WRITE_PACKABLE_DEFNS(NAME, ARRAY_TYPE, TYPE, ACCESSOR_NAME)
 //%- (void)write##NAME##Array:(int32_t)fieldNumber
 //%       NAME$S     values:(GPB##ARRAY_TYPE##Array *)values
@@ -452,7 +454,6 @@
 //%
 //%PDDM-EXPAND WRITE_PACKABLE_DEFNS(Double, Double, double, )
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeDoubleArray:(int32_t)fieldNumber
                   values:(GPBDoubleArray *)values
@@ -478,10 +479,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_PACKABLE_DEFNS(Float, Float, float, )
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeFloatArray:(int32_t)fieldNumber
                  values:(GPBFloatArray *)values
@@ -507,10 +506,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_PACKABLE_DEFNS(UInt64, UInt64, uint64_t, )
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeUInt64Array:(int32_t)fieldNumber
                   values:(GPBUInt64Array *)values
@@ -536,10 +533,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_PACKABLE_DEFNS(Int64, Int64, int64_t, )
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeInt64Array:(int32_t)fieldNumber
                  values:(GPBInt64Array *)values
@@ -565,10 +560,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_PACKABLE_DEFNS(Int32, Int32, int32_t, )
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeInt32Array:(int32_t)fieldNumber
                  values:(GPBInt32Array *)values
@@ -594,10 +587,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_PACKABLE_DEFNS(UInt32, UInt32, uint32_t, )
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeUInt32Array:(int32_t)fieldNumber
                   values:(GPBUInt32Array *)values
@@ -623,10 +614,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_PACKABLE_DEFNS(Fixed64, UInt64, uint64_t, )
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeFixed64Array:(int32_t)fieldNumber
                    values:(GPBUInt64Array *)values
@@ -652,10 +641,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_PACKABLE_DEFNS(Fixed32, UInt32, uint32_t, )
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeFixed32Array:(int32_t)fieldNumber
                    values:(GPBUInt32Array *)values
@@ -681,10 +668,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_PACKABLE_DEFNS(SInt32, Int32, int32_t, )
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeSInt32Array:(int32_t)fieldNumber
                   values:(GPBInt32Array *)values
@@ -710,10 +695,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_PACKABLE_DEFNS(SInt64, Int64, int64_t, )
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeSInt64Array:(int32_t)fieldNumber
                   values:(GPBInt64Array *)values
@@ -739,10 +722,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_PACKABLE_DEFNS(SFixed64, Int64, int64_t, )
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeSFixed64Array:(int32_t)fieldNumber
                     values:(GPBInt64Array *)values
@@ -768,10 +749,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_PACKABLE_DEFNS(SFixed32, Int32, int32_t, )
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeSFixed32Array:(int32_t)fieldNumber
                     values:(GPBInt32Array *)values
@@ -797,10 +776,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_PACKABLE_DEFNS(Bool, Bool, BOOL, )
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeBoolArray:(int32_t)fieldNumber
                 values:(GPBBoolArray *)values
@@ -826,10 +803,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_PACKABLE_DEFNS(Enum, Enum, int32_t, Raw)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeEnumArray:(int32_t)fieldNumber
                 values:(GPBEnumArray *)values
@@ -855,10 +830,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_UNPACKABLE_DEFNS(String, NSString)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeStringArray:(int32_t)fieldNumber values:(NSArray *)values {
   for (NSString *value in values) {
@@ -866,10 +839,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_UNPACKABLE_DEFNS(Message, GPBMessage)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeMessageArray:(int32_t)fieldNumber values:(NSArray *)values {
   for (GPBMessage *value in values) {
@@ -877,10 +848,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_UNPACKABLE_DEFNS(Bytes, NSData)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeBytesArray:(int32_t)fieldNumber values:(NSArray *)values {
   for (NSData *value in values) {
@@ -888,10 +857,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_UNPACKABLE_DEFNS(Group, GPBMessage)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeGroupArray:(int32_t)fieldNumber values:(NSArray *)values {
   for (GPBMessage *value in values) {
@@ -899,10 +866,8 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND WRITE_UNPACKABLE_DEFNS(UnknownGroup, GPBUnknownFieldSet)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)writeUnknownGroupArray:(int32_t)fieldNumber values:(NSArray *)values {
   for (GPBUnknownFieldSet *value in values) {
@@ -910,9 +875,10 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND-END (19 expansions)
 
+// clang-format on
+
 - (void)writeMessageSetExtension:(int32_t)fieldNumber
                            value:(GPBMessage *)value {
   GPBWriteTagWithFormat(&state_, GPBWireFormatMessageSetItem,
diff --git a/objectivec/GPBDictionary.h b/objectivec/GPBDictionary.h
index 28d880d..90440e3 100644
--- a/objectivec/GPBDictionary.h
+++ b/objectivec/GPBDictionary.h
@@ -43,9 +43,11 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-EXPAND DECLARE_DICTIONARIES()
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - UInt32 -> UInt32
 
@@ -5479,7 +5481,6 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND-END DECLARE_DICTIONARIES()
 
 NS_ASSUME_NONNULL_END
@@ -5770,3 +5771,5 @@
 //% **/
 //%- (void)setRawValue:(VALUE_TYPE)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key;
 //%
+
+// clang-format on
diff --git a/objectivec/GPBDictionary.m b/objectivec/GPBDictionary.m
index 77642c2..ccb2554 100644
--- a/objectivec/GPBDictionary.m
+++ b/objectivec/GPBDictionary.m
@@ -73,6 +73,9 @@
   return (value != kGPBUnrecognizedEnumeratorValue);
 }
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-DEFINE SERIALIZE_SUPPORT_2_TYPE(VALUE_NAME, VALUE_TYPE, GPBDATATYPE_NAME1, GPBDATATYPE_NAME2)
 //%static size_t ComputeDict##VALUE_NAME##FieldSize(VALUE_TYPE value, uint32_t fieldNum, GPBDataType dataType) {
 //%  if (dataType == GPBDataType##GPBDATATYPE_NAME1) {
@@ -147,7 +150,6 @@
 //%SERIALIZE_SUPPORT_3_TYPE(Object, id, Message, String, Bytes)
 //%PDDM-EXPAND SERIALIZE_SUPPORT_HELPERS()
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 static size_t ComputeDictInt32FieldSize(int32_t value, uint32_t fieldNum, GPBDataType dataType) {
   if (dataType == GPBDataTypeInt32) {
@@ -326,9 +328,10 @@
   }
 }
 
-// clang-format on
 //%PDDM-EXPAND-END SERIALIZE_SUPPORT_HELPERS()
 
+// clang-format on
+
 size_t GPBDictionaryComputeSizeInternalHelper(NSDictionary *dict, GPBFieldDescriptor *field) {
   GPBDataType mapValueType = GPBGetFieldDataType(field);
   size_t result = 0;
@@ -570,6 +573,9 @@
 // Macros for the common basic cases.
 //
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-DEFINE DICTIONARY_IMPL_FOR_POD_KEY(KEY_NAME, KEY_TYPE)
 //%DICTIONARY_POD_IMPL_FOR_KEY(KEY_NAME, KEY_TYPE, , POD)
 //%DICTIONARY_POD_KEY_TO_OBJECT_IMPL(KEY_NAME, KEY_TYPE, Object, id)
@@ -1429,7 +1435,6 @@
 
 //%PDDM-EXPAND DICTIONARY_IMPL_FOR_POD_KEY(UInt32, uint32_t)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - UInt32 -> UInt32
 
@@ -3176,10 +3181,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND DICTIONARY_IMPL_FOR_POD_KEY(Int32, int32_t)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Int32 -> UInt32
 
@@ -4926,10 +4929,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND DICTIONARY_IMPL_FOR_POD_KEY(UInt64, uint64_t)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - UInt64 -> UInt32
 
@@ -6676,10 +6677,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND DICTIONARY_IMPL_FOR_POD_KEY(Int64, int64_t)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Int64 -> UInt32
 
@@ -8426,10 +8425,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND DICTIONARY_POD_IMPL_FOR_KEY(String, NSString, *, OBJECT)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - String -> UInt32
 
@@ -10032,13 +10029,11 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND-END (5 expansions)
 
 
 //%PDDM-EXPAND DICTIONARY_BOOL_KEY_TO_POD_IMPL(UInt32, uint32_t)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool -> UInt32
 
@@ -10246,10 +10241,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND DICTIONARY_BOOL_KEY_TO_POD_IMPL(Int32, int32_t)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool -> Int32
 
@@ -10457,10 +10450,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND DICTIONARY_BOOL_KEY_TO_POD_IMPL(UInt64, uint64_t)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool -> UInt64
 
@@ -10668,10 +10659,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND DICTIONARY_BOOL_KEY_TO_POD_IMPL(Int64, int64_t)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool -> Int64
 
@@ -10879,10 +10868,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND DICTIONARY_BOOL_KEY_TO_POD_IMPL(Bool, BOOL)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool -> Bool
 
@@ -11090,10 +11077,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND DICTIONARY_BOOL_KEY_TO_POD_IMPL(Float, float)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool -> Float
 
@@ -11301,10 +11286,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND DICTIONARY_BOOL_KEY_TO_POD_IMPL(Double, double)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool -> Double
 
@@ -11512,10 +11495,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND DICTIONARY_BOOL_KEY_TO_OBJECT_IMPL(Object, id)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool -> Object
 
@@ -11744,9 +11725,10 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND-END (8 expansions)
 
+// clang-format on
+
 #pragma mark - Bool -> Enum
 
 @implementation GPBBoolEnumDictionary {
@@ -11916,9 +11898,10 @@
   }
 }
 
+// clang-format off
+
 //%PDDM-EXPAND SERIAL_DATA_FOR_ENTRY_POD_Enum(Bool)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (NSData *)serializedDataForUnknownValue:(int32_t)value
                                    forKey:(GPBGenericValue *)key
@@ -11933,9 +11916,10 @@
   return data;
 }
 
-// clang-format on
 //%PDDM-EXPAND-END SERIAL_DATA_FOR_ENTRY_POD_Enum(Bool)
 
+// clang-format on
+
 - (size_t)computeSerializedSizeAsField:(GPBFieldDescriptor *)field {
   GPBDataType valueDataType = GPBGetFieldDataType(field);
   NSUInteger count = 0;
diff --git a/objectivec/GPBDictionary_PackagePrivate.h b/objectivec/GPBDictionary_PackagePrivate.h
index d494b7e..82f053e 100644
--- a/objectivec/GPBDictionary_PackagePrivate.h
+++ b/objectivec/GPBDictionary_PackagePrivate.h
@@ -46,6 +46,9 @@
 - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block;
 @end
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-DEFINE DICTIONARY_PRIV_INTERFACES_FOR_POD_KEY(KEY_NAME)
 //%DICTIONARY_POD_PRIV_INTERFACES_FOR_KEY(KEY_NAME)
 //%DICTIONARY_PRIVATE_INTERFACES(KEY_NAME, Object, Object)
@@ -82,7 +85,6 @@
 
 //%PDDM-EXPAND DICTIONARY_PRIV_INTERFACES_FOR_POD_KEY(UInt32)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 @interface GPBUInt32UInt32Dictionary () <GPBDictionaryInternalsProtocol> {
  @package
@@ -144,10 +146,8 @@
     __attribute__((ns_returns_retained));
 @end
 
-// clang-format on
 //%PDDM-EXPAND DICTIONARY_PRIV_INTERFACES_FOR_POD_KEY(Int32)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 @interface GPBInt32UInt32Dictionary () <GPBDictionaryInternalsProtocol> {
  @package
@@ -209,10 +209,8 @@
     __attribute__((ns_returns_retained));
 @end
 
-// clang-format on
 //%PDDM-EXPAND DICTIONARY_PRIV_INTERFACES_FOR_POD_KEY(UInt64)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 @interface GPBUInt64UInt32Dictionary () <GPBDictionaryInternalsProtocol> {
  @package
@@ -274,10 +272,8 @@
     __attribute__((ns_returns_retained));
 @end
 
-// clang-format on
 //%PDDM-EXPAND DICTIONARY_PRIV_INTERFACES_FOR_POD_KEY(Int64)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 @interface GPBInt64UInt32Dictionary () <GPBDictionaryInternalsProtocol> {
  @package
@@ -339,10 +335,8 @@
     __attribute__((ns_returns_retained));
 @end
 
-// clang-format on
 //%PDDM-EXPAND DICTIONARY_PRIV_INTERFACES_FOR_POD_KEY(Bool)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 @interface GPBBoolUInt32Dictionary () <GPBDictionaryInternalsProtocol> {
  @package
@@ -404,10 +398,8 @@
     __attribute__((ns_returns_retained));
 @end
 
-// clang-format on
 //%PDDM-EXPAND DICTIONARY_POD_PRIV_INTERFACES_FOR_KEY(String)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 @interface GPBStringUInt32Dictionary () <GPBDictionaryInternalsProtocol> {
  @package
@@ -460,9 +452,10 @@
                               keyDataType:(GPBDataType)keyDataType;
 @end
 
-// clang-format on
 //%PDDM-EXPAND-END (6 expansions)
 
+// clang-format on
+
 #pragma mark - NSDictionary Subclass
 
 @interface GPBAutocreatedDictionary : NSMutableDictionary {
diff --git a/objectivec/GPBMessage.m b/objectivec/GPBMessage.m
index b293604..b494f36 100644
--- a/objectivec/GPBMessage.m
+++ b/objectivec/GPBMessage.m
@@ -1344,6 +1344,10 @@
   }
   uint32_t fieldNumber = GPBFieldNumber(field);
 
+  switch (GPBGetFieldDataType(field)) {
+
+// clang-format off
+
 //%PDDM-DEFINE FIELD_CASE(TYPE, REAL_TYPE)
 //%FIELD_CASE_FULL(TYPE, REAL_TYPE, REAL_TYPE)
 //%PDDM-DEFINE FIELD_CASE_FULL(TYPE, REAL_TYPE, ARRAY_TYPE)
@@ -1386,12 +1390,8 @@
 //%      }
 //%      break;
 //%
-
-  switch (GPBGetFieldDataType(field)) {
-
 //%PDDM-EXPAND FIELD_CASE(Bool, Bool)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeBool:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1410,10 +1410,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE(Fixed32, UInt32)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeFixed32:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1432,10 +1430,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE(SFixed32, Int32)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeSFixed32:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1454,10 +1450,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE(Float, Float)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeFloat:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1476,10 +1470,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE(Fixed64, UInt64)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeFixed64:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1498,10 +1490,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE(SFixed64, Int64)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeSFixed64:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1520,10 +1510,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE(Double, Double)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeDouble:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1542,10 +1530,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE(Int32, Int32)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeInt32:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1564,10 +1550,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE(Int64, Int64)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeInt64:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1586,10 +1570,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE(SInt32, Int32)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeSInt32:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1608,10 +1590,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE(SInt64, Int64)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeSInt64:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1630,10 +1610,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE(UInt32, UInt32)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeUInt32:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1652,10 +1630,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE(UInt64, UInt64)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeUInt64:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1674,10 +1650,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE_FULL(Enum, Int32, Enum)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeEnum:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1696,10 +1670,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE2(Bytes)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeBytes:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1722,10 +1694,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE2(String)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeString:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1748,10 +1718,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE2(Message)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeMessage:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1774,10 +1742,8 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND FIELD_CASE2(Group)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
     case GPBDataTypeGroup:
       if (fieldType == GPBFieldTypeRepeated) {
@@ -1800,8 +1766,9 @@
       }
       break;
 
-// clang-format on
 //%PDDM-EXPAND-END (18 expansions)
+
+// clang-format off
   }
 }
 
diff --git a/objectivec/GPBProtocolBuffers.h b/objectivec/GPBProtocolBuffers.h
index 619c082..e5f4713 100644
--- a/objectivec/GPBProtocolBuffers.h
+++ b/objectivec/GPBProtocolBuffers.h
@@ -28,7 +28,9 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+// clang-format off
 #import "GPBBootstrap.h"
+// clang-format on
 
 #import "GPBArray.h"
 #import "GPBCodedInputStream.h"
diff --git a/objectivec/GPBProtocolBuffers_RuntimeSupport.h b/objectivec/GPBProtocolBuffers_RuntimeSupport.h
index 04dde62..804a68a 100644
--- a/objectivec/GPBProtocolBuffers_RuntimeSupport.h
+++ b/objectivec/GPBProtocolBuffers_RuntimeSupport.h
@@ -31,7 +31,9 @@
 // This header is meant to only be used by the generated source, it should not
 // be included in code using protocol buffers.
 
+// clang-format off
 #import "GPBBootstrap.h"
+// clang-format on
 
 #import "GPBDescriptor_PackagePrivate.h"
 #import "GPBExtensionInternals.h"
diff --git a/objectivec/GPBUtilities.h b/objectivec/GPBUtilities.h
index 75759b2..fd5a463 100644
--- a/objectivec/GPBUtilities.h
+++ b/objectivec/GPBUtilities.h
@@ -102,9 +102,11 @@
  **/
 void GPBClearOneof(GPBMessage *self, GPBOneofDescriptor *oneof);
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-EXPAND GPB_ACCESSORS()
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 
 //
@@ -395,9 +397,10 @@
                            GPBFieldDescriptor *field,
                            id dictionary);
 
-// clang-format on
 //%PDDM-EXPAND-END GPB_ACCESSORS()
 
+// clang-format on
+
 /**
  * Returns an empty NSData to assign to byte fields when you wish to assign them
  * to empty. Prevents allocating a lot of little [NSData data] objects.
@@ -413,6 +416,8 @@
 
 CF_EXTERN_C_END
 
+// Disable clang-format for the macros.
+// clang-format off
 
 //%PDDM-DEFINE GPB_ACCESSORS()
 //%
@@ -549,3 +554,5 @@
 //% **/
 //%void GPBSetMessage##NAME##Field(GPBMessage *self, GPBFieldDescriptor *field, TYPE TisP##value);
 //%
+
+// clang-format on
diff --git a/objectivec/GPBUtilities.m b/objectivec/GPBUtilities.m
index cd0910c..739e36c 100644
--- a/objectivec/GPBUtilities.m
+++ b/objectivec/GPBUtilities.m
@@ -371,6 +371,8 @@
 
 #pragma mark - IVar accessors
 
+// clang-format off
+
 //%PDDM-DEFINE IVAR_POD_ACCESSORS_DEFN(NAME, TYPE)
 //%TYPE GPBGetMessage##NAME##Field(GPBMessage *self,
 //% TYPE$S            NAME$S       GPBFieldDescriptor *field) {
@@ -501,6 +503,8 @@
 //%}
 //%
 
+// clang-format on
+
 // Object types are handled slightly differently, they need to be released
 // and retained.
 
@@ -804,9 +808,10 @@
   GPBBecomeVisibleToAutocreator(self);
 }
 
+// clang-format off
+
 //%PDDM-EXPAND IVAR_POD_ACCESSORS_DEFN(Int32, int32_t)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 int32_t GPBGetMessageInt32Field(GPBMessage *self,
                                 GPBFieldDescriptor *field) {
@@ -876,10 +881,8 @@
   GPBBecomeVisibleToAutocreator(self);
 }
 
-// clang-format on
 //%PDDM-EXPAND IVAR_POD_ACCESSORS_DEFN(UInt32, uint32_t)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 uint32_t GPBGetMessageUInt32Field(GPBMessage *self,
                                   GPBFieldDescriptor *field) {
@@ -949,10 +952,8 @@
   GPBBecomeVisibleToAutocreator(self);
 }
 
-// clang-format on
 //%PDDM-EXPAND IVAR_POD_ACCESSORS_DEFN(Int64, int64_t)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 int64_t GPBGetMessageInt64Field(GPBMessage *self,
                                 GPBFieldDescriptor *field) {
@@ -1022,10 +1023,8 @@
   GPBBecomeVisibleToAutocreator(self);
 }
 
-// clang-format on
 //%PDDM-EXPAND IVAR_POD_ACCESSORS_DEFN(UInt64, uint64_t)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 uint64_t GPBGetMessageUInt64Field(GPBMessage *self,
                                   GPBFieldDescriptor *field) {
@@ -1095,10 +1094,8 @@
   GPBBecomeVisibleToAutocreator(self);
 }
 
-// clang-format on
 //%PDDM-EXPAND IVAR_POD_ACCESSORS_DEFN(Float, float)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 float GPBGetMessageFloatField(GPBMessage *self,
                               GPBFieldDescriptor *field) {
@@ -1168,10 +1165,8 @@
   GPBBecomeVisibleToAutocreator(self);
 }
 
-// clang-format on
 //%PDDM-EXPAND IVAR_POD_ACCESSORS_DEFN(Double, double)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 double GPBGetMessageDoubleField(GPBMessage *self,
                                 GPBFieldDescriptor *field) {
@@ -1241,14 +1236,12 @@
   GPBBecomeVisibleToAutocreator(self);
 }
 
-// clang-format on
 //%PDDM-EXPAND-END (6 expansions)
 
 // Aliases are function calls that are virtually the same.
 
 //%PDDM-EXPAND IVAR_ALIAS_DEFN_COPY_OBJECT(String, NSString)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 // Only exists for public api, no core code should use this.
 NSString *GPBGetMessageStringField(GPBMessage *self,
@@ -1279,10 +1272,8 @@
   GPBSetCopyObjectIvarWithField(self, field, (id)value);
 }
 
-// clang-format on
 //%PDDM-EXPAND IVAR_ALIAS_DEFN_COPY_OBJECT(Bytes, NSData)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 // Only exists for public api, no core code should use this.
 NSData *GPBGetMessageBytesField(GPBMessage *self,
@@ -1313,10 +1304,8 @@
   GPBSetCopyObjectIvarWithField(self, field, (id)value);
 }
 
-// clang-format on
 //%PDDM-EXPAND IVAR_ALIAS_DEFN_OBJECT(Message, GPBMessage)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 // Only exists for public api, no core code should use this.
 GPBMessage *GPBGetMessageMessageField(GPBMessage *self,
@@ -1347,10 +1336,8 @@
   GPBSetObjectIvarWithField(self, field, (id)value);
 }
 
-// clang-format on
 //%PDDM-EXPAND IVAR_ALIAS_DEFN_OBJECT(Group, GPBMessage)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 // Only exists for public api, no core code should use this.
 GPBMessage *GPBGetMessageGroupField(GPBMessage *self,
@@ -1381,9 +1368,10 @@
   GPBSetObjectIvarWithField(self, field, (id)value);
 }
 
-// clang-format on
 //%PDDM-EXPAND-END (4 expansions)
 
+// clang-format on
+
 // GPBGetMessageRepeatedField is defined in GPBMessage.m
 
 // Only exists for public api, no core code should use this.
@@ -2050,12 +2038,12 @@
       enumerateValuesWithBlock:^(CTYPE value, NSUInteger idx, BOOL * stop) {  \
     _Pragma("unused(idx, stop)");                                             \
     [result                                                                   \
-        appendFormat:@"%@%d: " #FORMAT "\n", lineIndent, fieldNumber, value]; \
+        appendFormat:@"%@%d: " FORMAT "\n", lineIndent, fieldNumber, value]; \
       }];
 
-    PRINT_LOOP(varintList, uint64_t, %llu);
-    PRINT_LOOP(fixed32List, uint32_t, 0x%X);
-    PRINT_LOOP(fixed64List, uint64_t, 0x%llX);
+    PRINT_LOOP(varintList, uint64_t, "%llu");
+    PRINT_LOOP(fixed32List, uint32_t, "0x%X");
+    PRINT_LOOP(fixed64List, uint64_t, "0x%llX");
 
 #undef PRINT_LOOP
 
diff --git a/objectivec/GPBUtilities_PackagePrivate.h b/objectivec/GPBUtilities_PackagePrivate.h
index 3d3d734..042396b 100644
--- a/objectivec/GPBUtilities_PackagePrivate.h
+++ b/objectivec/GPBUtilities_PackagePrivate.h
@@ -209,68 +209,59 @@
 
 #pragma clang diagnostic pop
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-DEFINE GPB_IVAR_SET_DECL(NAME, TYPE)
 //%void GPBSet##NAME##IvarWithFieldPrivate(GPBMessage *self,
 //%            NAME$S                    GPBFieldDescriptor *field,
 //%            NAME$S                    TYPE value);
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(Bool, BOOL)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 void GPBSetBoolIvarWithFieldPrivate(GPBMessage *self,
                                     GPBFieldDescriptor *field,
                                     BOOL value);
-// clang-format on
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(Int32, int32_t)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 void GPBSetInt32IvarWithFieldPrivate(GPBMessage *self,
                                      GPBFieldDescriptor *field,
                                      int32_t value);
-// clang-format on
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(UInt32, uint32_t)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 void GPBSetUInt32IvarWithFieldPrivate(GPBMessage *self,
                                       GPBFieldDescriptor *field,
                                       uint32_t value);
-// clang-format on
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(Int64, int64_t)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 void GPBSetInt64IvarWithFieldPrivate(GPBMessage *self,
                                      GPBFieldDescriptor *field,
                                      int64_t value);
-// clang-format on
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(UInt64, uint64_t)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 void GPBSetUInt64IvarWithFieldPrivate(GPBMessage *self,
                                       GPBFieldDescriptor *field,
                                       uint64_t value);
-// clang-format on
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(Float, float)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 void GPBSetFloatIvarWithFieldPrivate(GPBMessage *self,
                                      GPBFieldDescriptor *field,
                                      float value);
-// clang-format on
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(Double, double)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 void GPBSetDoubleIvarWithFieldPrivate(GPBMessage *self,
                                       GPBFieldDescriptor *field,
                                       double value);
-// clang-format on
 //%PDDM-EXPAND-END (7 expansions)
 
+// clang-format on
+
 void GPBSetEnumIvarWithFieldPrivate(GPBMessage *self,
                                     GPBFieldDescriptor *field,
                                     int32_t value);
diff --git a/objectivec/Tests/GPBArrayTests.m b/objectivec/Tests/GPBArrayTests.m
index 9b004bc..6bb5c1d 100644
--- a/objectivec/Tests/GPBArrayTests.m
+++ b/objectivec/Tests/GPBArrayTests.m
@@ -87,6 +87,9 @@
 
 #pragma mark - PDDM Macros
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-DEFINE ARRAY_TESTS(NAME, TYPE, VAL1, VAL2, VAL3, VAL4)
 //%ARRAY_TESTS2(NAME, TYPE, VAL1, VAL2, VAL3, VAL4, )
 //%PDDM-DEFINE ARRAY_TESTS2(NAME, TYPE, VAL1, VAL2, VAL3, VAL4, HELPER)
@@ -433,7 +436,6 @@
 //%
 //%PDDM-EXPAND ARRAY_TESTS(Int32, int32_t, 1, 2, 3, 4)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Int32
 
@@ -776,10 +778,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND ARRAY_TESTS(UInt32, uint32_t, 11U, 12U, 13U, 14U)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - UInt32
 
@@ -1122,10 +1122,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND ARRAY_TESTS(Int64, int64_t, 31LL, 32LL, 33LL, 34LL)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Int64
 
@@ -1468,10 +1466,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND ARRAY_TESTS(UInt64, uint64_t, 41ULL, 42ULL, 43ULL, 44ULL)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - UInt64
 
@@ -1814,10 +1810,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND ARRAY_TESTS(Float, float, 51.f, 52.f, 53.f, 54.f)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Float
 
@@ -2160,10 +2154,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND ARRAY_TESTS(Double, double, 61., 62., 63., 64.)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Double
 
@@ -2506,10 +2498,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND ARRAY_TESTS(Bool, BOOL, TRUE, TRUE, FALSE, FALSE)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool
 
@@ -2852,10 +2842,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND ARRAY_TESTS2(Enum, int32_t, 71, 72, 73, 74, Raw)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Enum
 
@@ -3198,9 +3186,10 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND-END (8 expansions)
 
+// clang-format on
+
 #pragma mark - Non macro-based Enum tests
 
 // These are hand written tests to cover the verification and raw methods.
diff --git a/objectivec/Tests/GPBDictionaryTests+Bool.m b/objectivec/Tests/GPBDictionaryTests+Bool.m
index fbab9ff..ea4e79a 100644
--- a/objectivec/Tests/GPBDictionaryTests+Bool.m
+++ b/objectivec/Tests/GPBDictionaryTests+Bool.m
@@ -36,13 +36,15 @@
 #import "GPBTestUtilities.h"
 #import "objectivec/Tests/UnittestRuntimeProto2.pbobjc.h"
 
+// Disable clang-format for the macros.
+// clang-format off
+
 // Pull in the macros (using an external file because expanding all tests
 // in a single file makes a file that is failing to work with within Xcode.
 //%PDDM-IMPORT-DEFINES GPBDictionaryTests.pddm
 
 //%PDDM-EXPAND BOOL_TESTS_FOR_POD_VALUE(UInt32, uint32_t, 100U, 101U)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool -> UInt32
 
@@ -346,10 +348,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND BOOL_TESTS_FOR_POD_VALUE(Int32, int32_t, 200, 201)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool -> Int32
 
@@ -653,10 +653,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND BOOL_TESTS_FOR_POD_VALUE(UInt64, uint64_t, 300U, 301U)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool -> UInt64
 
@@ -960,10 +958,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND BOOL_TESTS_FOR_POD_VALUE(Int64, int64_t, 400, 401)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool -> Int64
 
@@ -1267,10 +1263,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND BOOL_TESTS_FOR_POD_VALUE(Bool, BOOL, NO, YES)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool -> Bool
 
@@ -1574,10 +1568,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND BOOL_TESTS_FOR_POD_VALUE(Float, float, 500.f, 501.f)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool -> Float
 
@@ -1881,10 +1873,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND BOOL_TESTS_FOR_POD_VALUE(Double, double, 600., 601.)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool -> Double
 
@@ -2188,10 +2178,8 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND TESTS_FOR_BOOL_KEY_OBJECT_VALUE(Object, NSString*, @"abc", @"def")
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 #pragma mark - Bool -> Object
 
@@ -2460,7 +2448,6 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND-END (8 expansions)
 
 
diff --git a/objectivec/Tests/GPBDictionaryTests+Int32.m b/objectivec/Tests/GPBDictionaryTests+Int32.m
index 3ffdd21..0b46b0f 100644
--- a/objectivec/Tests/GPBDictionaryTests+Int32.m
+++ b/objectivec/Tests/GPBDictionaryTests+Int32.m
@@ -36,13 +36,15 @@
 #import "GPBTestUtilities.h"
 #import "objectivec/Tests/UnittestRuntimeProto2.pbobjc.h"
 
+// Disable clang-format for the macros.
+// clang-format off
+
 // Pull in the macros (using an external file because expanding all tests
 // in a single file makes a file that is failing to work with within Xcode.
 //%PDDM-IMPORT-DEFINES GPBDictionaryTests.pddm
 
 //%PDDM-EXPAND TEST_FOR_POD_KEY(Int32, int32_t, 11, 12, 13, 14)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 // To let the testing macros work, add some extra methods to simplify things.
 @interface GPBInt32EnumDictionary (TestingTweak)
@@ -3673,6 +3675,5 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND-END TEST_FOR_POD_KEY(Int32, int32_t, 11, 12, 13, 14)
 
diff --git a/objectivec/Tests/GPBDictionaryTests+Int64.m b/objectivec/Tests/GPBDictionaryTests+Int64.m
index 9d8a946..9456791 100644
--- a/objectivec/Tests/GPBDictionaryTests+Int64.m
+++ b/objectivec/Tests/GPBDictionaryTests+Int64.m
@@ -36,13 +36,15 @@
 #import "GPBTestUtilities.h"
 #import "objectivec/Tests/UnittestRuntimeProto2.pbobjc.h"
 
+// Disable clang-format for the macros.
+// clang-format off
+
 // Pull in the macros (using an external file because expanding all tests
 // in a single file makes a file that is failing to work with within Xcode.
 //%PDDM-IMPORT-DEFINES GPBDictionaryTests.pddm
 
 //%PDDM-EXPAND TEST_FOR_POD_KEY(Int64, int64_t, 21LL, 22LL, 23LL, 24LL)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 // To let the testing macros work, add some extra methods to simplify things.
 @interface GPBInt64EnumDictionary (TestingTweak)
@@ -3673,6 +3675,5 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND-END TEST_FOR_POD_KEY(Int64, int64_t, 21LL, 22LL, 23LL, 24LL)
 
diff --git a/objectivec/Tests/GPBDictionaryTests+String.m b/objectivec/Tests/GPBDictionaryTests+String.m
index c2fdac3..181dfc6 100644
--- a/objectivec/Tests/GPBDictionaryTests+String.m
+++ b/objectivec/Tests/GPBDictionaryTests+String.m
@@ -36,13 +36,15 @@
 #import "GPBTestUtilities.h"
 #import "objectivec/Tests/UnittestRuntimeProto2.pbobjc.h"
 
+// Disable clang-format for the macros.
+// clang-format off
+
 // Pull in the macros (using an external file because expanding all tests
 // in a single file makes a file that is failing to work with within Xcode.
 //%PDDM-IMPORT-DEFINES GPBDictionaryTests.pddm
 
-//%PDDM-EXPAND TESTS_FOR_POD_VALUES(String, NSString, *, Objects, @"foo", @"bar", @"baz", @"mumble")
+//%PDDM-EXPAND TESTS_FOR_POD_VALUES(String,NSString,*,Objects,@"foo",@"bar",@"baz",@"mumble")
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 // To let the testing macros work, add some extra methods to simplify things.
 @interface GPBStringEnumDictionary (TestingTweak)
@@ -3381,6 +3383,4 @@
 
 @end
 
-// clang-format on
-//%PDDM-EXPAND-END TESTS_FOR_POD_VALUES(String, NSString, *, Objects, @"foo", @"bar", @"baz", @"mumble")
-
+//%PDDM-EXPAND-END TESTS_FOR_POD_VALUES(String,NSString,*,Objects,@"foo",@"bar",@"baz",@"mumble")
diff --git a/objectivec/Tests/GPBDictionaryTests+UInt32.m b/objectivec/Tests/GPBDictionaryTests+UInt32.m
index a00dd62..edc2e74 100644
--- a/objectivec/Tests/GPBDictionaryTests+UInt32.m
+++ b/objectivec/Tests/GPBDictionaryTests+UInt32.m
@@ -36,13 +36,15 @@
 #import "GPBTestUtilities.h"
 #import "objectivec/Tests/UnittestRuntimeProto2.pbobjc.h"
 
+// Disable clang-format for the macros.
+// clang-format off
+
 // Pull in the macros (using an external file because expanding all tests
 // in a single file makes a file that is failing to work with within Xcode.
 //%PDDM-IMPORT-DEFINES GPBDictionaryTests.pddm
 
 //%PDDM-EXPAND TEST_FOR_POD_KEY(UInt32, uint32_t, 1U, 2U, 3U, 4U)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 // To let the testing macros work, add some extra methods to simplify things.
 @interface GPBUInt32EnumDictionary (TestingTweak)
@@ -3673,6 +3675,5 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND-END TEST_FOR_POD_KEY(UInt32, uint32_t, 1U, 2U, 3U, 4U)
 
diff --git a/objectivec/Tests/GPBDictionaryTests+UInt64.m b/objectivec/Tests/GPBDictionaryTests+UInt64.m
index e1ac143..7f6c983 100644
--- a/objectivec/Tests/GPBDictionaryTests+UInt64.m
+++ b/objectivec/Tests/GPBDictionaryTests+UInt64.m
@@ -36,13 +36,15 @@
 #import "GPBTestUtilities.h"
 #import "objectivec/Tests/UnittestRuntimeProto2.pbobjc.h"
 
+// Disable clang-format for the macros.
+// clang-format off
+
 // Pull in the macros (using an external file because expanding all tests
 // in a single file makes a file that is failing to work with within Xcode.
 //%PDDM-IMPORT-DEFINES GPBDictionaryTests.pddm
 
 //%PDDM-EXPAND TEST_FOR_POD_KEY(UInt64, uint64_t, 31ULL, 32ULL, 33ULL, 34ULL)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 // To let the testing macros work, add some extra methods to simplify things.
 @interface GPBUInt64EnumDictionary (TestingTweak)
@@ -3673,5 +3675,4 @@
 
 @end
 
-// clang-format on
 //%PDDM-EXPAND-END TEST_FOR_POD_KEY(UInt64, uint64_t, 31ULL, 32ULL, 33ULL, 34ULL)
diff --git a/objectivec/Tests/GPBMessageTests+Merge.m b/objectivec/Tests/GPBMessageTests+Merge.m
index 8469746..743b521 100644
--- a/objectivec/Tests/GPBMessageTests+Merge.m
+++ b/objectivec/Tests/GPBMessageTests+Merge.m
@@ -258,6 +258,9 @@
 
   dst.oneofEnum = Message2_Enum_Bar;
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-DEFINE MERGE2_TEST(SET_NAME, SET_VALUE, CLEARED_NAME, CLEARED_DEFAULT)
 //%  src.oneof##SET_NAME = SET_VALUE;
 //%  [dst mergeFrom:src];
@@ -267,7 +270,6 @@
 //%
 //%PDDM-EXPAND MERGE2_TEST(Int32, 10, Enum, Message2_Enum_Baz)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofInt32 = 10;
   [dst mergeFrom:src];
@@ -275,10 +277,8 @@
   XCTAssertEqual(dst.oneofInt32, 10);
   XCTAssertEqual(dst.oneofEnum, Message2_Enum_Baz);
 
-// clang-format on
 //%PDDM-EXPAND MERGE2_TEST(Int64, 11, Int32, 100)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofInt64 = 11;
   [dst mergeFrom:src];
@@ -286,10 +286,8 @@
   XCTAssertEqual(dst.oneofInt64, 11);
   XCTAssertEqual(dst.oneofInt32, 100);
 
-// clang-format on
 //%PDDM-EXPAND MERGE2_TEST(Uint32, 12U, Int64, 101)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofUint32 = 12U;
   [dst mergeFrom:src];
@@ -297,10 +295,8 @@
   XCTAssertEqual(dst.oneofUint32, 12U);
   XCTAssertEqual(dst.oneofInt64, 101);
 
-// clang-format on
 //%PDDM-EXPAND MERGE2_TEST(Uint64, 13U, Uint32, 102U)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofUint64 = 13U;
   [dst mergeFrom:src];
@@ -308,10 +304,8 @@
   XCTAssertEqual(dst.oneofUint64, 13U);
   XCTAssertEqual(dst.oneofUint32, 102U);
 
-// clang-format on
 //%PDDM-EXPAND MERGE2_TEST(Sint32, 14, Uint64, 103U)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofSint32 = 14;
   [dst mergeFrom:src];
@@ -319,10 +313,8 @@
   XCTAssertEqual(dst.oneofSint32, 14);
   XCTAssertEqual(dst.oneofUint64, 103U);
 
-// clang-format on
 //%PDDM-EXPAND MERGE2_TEST(Sint64, 15, Sint32, 104)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofSint64 = 15;
   [dst mergeFrom:src];
@@ -330,10 +322,8 @@
   XCTAssertEqual(dst.oneofSint64, 15);
   XCTAssertEqual(dst.oneofSint32, 104);
 
-// clang-format on
 //%PDDM-EXPAND MERGE2_TEST(Fixed32, 16U, Sint64, 105)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofFixed32 = 16U;
   [dst mergeFrom:src];
@@ -341,10 +331,8 @@
   XCTAssertEqual(dst.oneofFixed32, 16U);
   XCTAssertEqual(dst.oneofSint64, 105);
 
-// clang-format on
 //%PDDM-EXPAND MERGE2_TEST(Fixed64, 17U, Fixed32, 106U)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofFixed64 = 17U;
   [dst mergeFrom:src];
@@ -352,10 +340,8 @@
   XCTAssertEqual(dst.oneofFixed64, 17U);
   XCTAssertEqual(dst.oneofFixed32, 106U);
 
-// clang-format on
 //%PDDM-EXPAND MERGE2_TEST(Sfixed32, 18, Fixed64, 107U)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofSfixed32 = 18;
   [dst mergeFrom:src];
@@ -363,10 +349,8 @@
   XCTAssertEqual(dst.oneofSfixed32, 18);
   XCTAssertEqual(dst.oneofFixed64, 107U);
 
-// clang-format on
 //%PDDM-EXPAND MERGE2_TEST(Sfixed64, 19, Sfixed32, 108)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofSfixed64 = 19;
   [dst mergeFrom:src];
@@ -374,10 +358,8 @@
   XCTAssertEqual(dst.oneofSfixed64, 19);
   XCTAssertEqual(dst.oneofSfixed32, 108);
 
-// clang-format on
 //%PDDM-EXPAND MERGE2_TEST(Float, 20.0f, Sfixed64, 109)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofFloat = 20.0f;
   [dst mergeFrom:src];
@@ -385,10 +367,8 @@
   XCTAssertEqual(dst.oneofFloat, 20.0f);
   XCTAssertEqual(dst.oneofSfixed64, 109);
 
-// clang-format on
 //%PDDM-EXPAND MERGE2_TEST(Double, 21.0, Float, 110.0f)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofDouble = 21.0;
   [dst mergeFrom:src];
@@ -396,10 +376,8 @@
   XCTAssertEqual(dst.oneofDouble, 21.0);
   XCTAssertEqual(dst.oneofFloat, 110.0f);
 
-// clang-format on
 //%PDDM-EXPAND MERGE2_TEST(Bool, NO, Double, 111.0)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofBool = NO;
   [dst mergeFrom:src];
@@ -407,10 +385,8 @@
   XCTAssertEqual(dst.oneofBool, NO);
   XCTAssertEqual(dst.oneofDouble, 111.0);
 
-// clang-format on
 //%PDDM-EXPAND MERGE2_TEST(Enum, Message2_Enum_Bar, Bool, YES)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofEnum = Message2_Enum_Bar;
   [dst mergeFrom:src];
@@ -418,9 +394,10 @@
   XCTAssertEqual(dst.oneofEnum, Message2_Enum_Bar);
   XCTAssertEqual(dst.oneofBool, YES);
 
-// clang-format on
 //%PDDM-EXPAND-END (14 expansions)
 
+// clang-format on
+
   NSString *oneofStringDefault = @"string";
   NSData *oneofBytesDefault = [@"data" dataUsingEncoding:NSUTF8StringEncoding];
 
@@ -506,6 +483,9 @@
 
   dst.oneofEnum = Message3_Enum_Bar;
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-DEFINE MERGE3_TEST(SET_NAME, SET_VALUE, CLEARED_NAME, CLEARED_DEFAULT)
 //%  src.oneof##SET_NAME = SET_VALUE;
 //%  [dst mergeFrom:src];
@@ -515,7 +495,6 @@
 //%
 //%PDDM-EXPAND MERGE3_TEST(Int32, 10, Enum, Message3_Enum_Foo)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofInt32 = 10;
   [dst mergeFrom:src];
@@ -523,10 +502,8 @@
   XCTAssertEqual(dst.oneofInt32, 10);
   XCTAssertEqual(dst.oneofEnum, Message3_Enum_Foo);
 
-// clang-format on
 //%PDDM-EXPAND MERGE3_TEST(Int64, 11, Int32, 0)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofInt64 = 11;
   [dst mergeFrom:src];
@@ -534,10 +511,8 @@
   XCTAssertEqual(dst.oneofInt64, 11);
   XCTAssertEqual(dst.oneofInt32, 0);
 
-// clang-format on
 //%PDDM-EXPAND MERGE3_TEST(Uint32, 12U, Int64, 0)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofUint32 = 12U;
   [dst mergeFrom:src];
@@ -545,10 +520,8 @@
   XCTAssertEqual(dst.oneofUint32, 12U);
   XCTAssertEqual(dst.oneofInt64, 0);
 
-// clang-format on
 //%PDDM-EXPAND MERGE3_TEST(Uint64, 13U, Uint32, 0U)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofUint64 = 13U;
   [dst mergeFrom:src];
@@ -556,10 +529,8 @@
   XCTAssertEqual(dst.oneofUint64, 13U);
   XCTAssertEqual(dst.oneofUint32, 0U);
 
-// clang-format on
 //%PDDM-EXPAND MERGE3_TEST(Sint32, 14, Uint64, 0U)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofSint32 = 14;
   [dst mergeFrom:src];
@@ -567,10 +538,8 @@
   XCTAssertEqual(dst.oneofSint32, 14);
   XCTAssertEqual(dst.oneofUint64, 0U);
 
-// clang-format on
 //%PDDM-EXPAND MERGE3_TEST(Sint64, 15, Sint32, 0)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofSint64 = 15;
   [dst mergeFrom:src];
@@ -578,10 +547,8 @@
   XCTAssertEqual(dst.oneofSint64, 15);
   XCTAssertEqual(dst.oneofSint32, 0);
 
-// clang-format on
 //%PDDM-EXPAND MERGE3_TEST(Fixed32, 16U, Sint64, 0)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofFixed32 = 16U;
   [dst mergeFrom:src];
@@ -589,10 +556,8 @@
   XCTAssertEqual(dst.oneofFixed32, 16U);
   XCTAssertEqual(dst.oneofSint64, 0);
 
-// clang-format on
 //%PDDM-EXPAND MERGE3_TEST(Fixed64, 17U, Fixed32, 0U)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofFixed64 = 17U;
   [dst mergeFrom:src];
@@ -600,10 +565,8 @@
   XCTAssertEqual(dst.oneofFixed64, 17U);
   XCTAssertEqual(dst.oneofFixed32, 0U);
 
-// clang-format on
 //%PDDM-EXPAND MERGE3_TEST(Sfixed32, 18, Fixed64, 0U)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofSfixed32 = 18;
   [dst mergeFrom:src];
@@ -611,10 +574,8 @@
   XCTAssertEqual(dst.oneofSfixed32, 18);
   XCTAssertEqual(dst.oneofFixed64, 0U);
 
-// clang-format on
 //%PDDM-EXPAND MERGE3_TEST(Sfixed64, 19, Sfixed32, 0)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofSfixed64 = 19;
   [dst mergeFrom:src];
@@ -622,10 +583,8 @@
   XCTAssertEqual(dst.oneofSfixed64, 19);
   XCTAssertEqual(dst.oneofSfixed32, 0);
 
-// clang-format on
 //%PDDM-EXPAND MERGE3_TEST(Float, 20.0f, Sfixed64, 0)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofFloat = 20.0f;
   [dst mergeFrom:src];
@@ -633,10 +592,8 @@
   XCTAssertEqual(dst.oneofFloat, 20.0f);
   XCTAssertEqual(dst.oneofSfixed64, 0);
 
-// clang-format on
 //%PDDM-EXPAND MERGE3_TEST(Double, 21.0, Float, 0.0f)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofDouble = 21.0;
   [dst mergeFrom:src];
@@ -644,10 +601,8 @@
   XCTAssertEqual(dst.oneofDouble, 21.0);
   XCTAssertEqual(dst.oneofFloat, 0.0f);
 
-// clang-format on
 //%PDDM-EXPAND MERGE3_TEST(Bool, YES, Double, 0.0)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofBool = YES;
   [dst mergeFrom:src];
@@ -655,10 +610,8 @@
   XCTAssertEqual(dst.oneofBool, YES);
   XCTAssertEqual(dst.oneofDouble, 0.0);
 
-// clang-format on
 //%PDDM-EXPAND MERGE3_TEST(Enum, Message3_Enum_Bar, Bool, NO)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   src.oneofEnum = Message3_Enum_Bar;
   [dst mergeFrom:src];
@@ -666,9 +619,10 @@
   XCTAssertEqual(dst.oneofEnum, Message3_Enum_Bar);
   XCTAssertEqual(dst.oneofBool, NO);
 
-// clang-format on
 //%PDDM-EXPAND-END (14 expansions)
 
+// clang-format on
+
   NSString *oneofStringDefault = @"";
   NSData *oneofBytesDefault = [NSData data];
 
diff --git a/objectivec/Tests/GPBMessageTests+Runtime.m b/objectivec/Tests/GPBMessageTests+Runtime.m
index cdaea34..aefdf75 100644
--- a/objectivec/Tests/GPBMessageTests+Runtime.m
+++ b/objectivec/Tests/GPBMessageTests+Runtime.m
@@ -337,6 +337,9 @@
   // being true.
   //
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-DEFINE PROTO2_TEST_HAS_FIELD(FIELD, NON_ZERO_VALUE, ZERO_VALUE)
 //%  {  // optional##FIELD :: NON_ZERO_VALUE
 //%    Message2 *msg = [[Message2 alloc] init];
@@ -399,7 +402,6 @@
 //%PROTO2_TEST_CLEAR_FIELD_WITH_NIL(Message, [Message2 message])
 //%PDDM-EXPAND PROTO2_TEST_HAS_FIELDS()
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   {  // optionalInt32 :: 1
     Message2 *msg = [[Message2 alloc] init];
@@ -753,8 +755,9 @@
     [msg release];
   }
 
-// clang-format on
 //%PDDM-EXPAND-END PROTO2_TEST_HAS_FIELDS()
+
+// clang-format on
 }
 
 - (void)testProto3SingleFieldHasBehavior {
@@ -763,6 +766,9 @@
   // being true.  When set to the default, shouldn't be true.
   //
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-DEFINE PROTO3_TEST_HAS_FIELD(FIELD, NON_ZERO_VALUE, ZERO_VALUE)
 //%  {  // optional##FIELD
 //%    Message3 *msg = [[Message3 alloc] init];
@@ -815,7 +821,6 @@
 //%PROTO3_TEST_CLEAR_FIELD_WITH_NIL(Message, [Message3 message])
 //%PDDM-EXPAND PROTO3_TEST_HAS_FIELDS()
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   {  // optionalInt32
     Message3 *msg = [[Message3 alloc] init];
@@ -1015,8 +1020,9 @@
     [msg release];
   }
 
-// clang-format on
 //%PDDM-EXPAND-END PROTO3_TEST_HAS_FIELDS()
+
+// clang-format on
 }
 
 - (void)testProto3SingleOptionalFieldHasBehavior {
@@ -1024,6 +1030,9 @@
   // Setting to any value including the default (0) should result in true.
   //
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-DEFINE PROTO3_TEST_OPTIONAL_HAS_FIELD(FIELD, NON_ZERO_VALUE, ZERO_VALUE)
 //%  {  // optional##FIELD
 //%    Message3Optional *msg = [[Message3Optional alloc] init];
@@ -1060,7 +1069,6 @@
 //%PROTO3_TEST_OPTIONAL_HAS_FIELD(Enum, Message3Optional_Enum_Bar, Message3Optional_Enum_Foo)
 //%PDDM-EXPAND PROTO3_TEST_OPTIONAL_HAS_FIELDS()
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   {  // optionalInt32
     Message3Optional *msg = [[Message3Optional alloc] init];
@@ -1258,8 +1266,9 @@
     [msg release];
   }
 
-// clang-format on
 //%PDDM-EXPAND-END PROTO3_TEST_OPTIONAL_HAS_FIELDS()
+
+// clang-format on
 }
 
 - (void)testAccessingProto2UnknownEnumValues {
diff --git a/objectivec/Tests/GPBMessageTests+Serialization.m b/objectivec/Tests/GPBMessageTests+Serialization.m
index 0427683..cfbc597 100644
--- a/objectivec/Tests/GPBMessageTests+Serialization.m
+++ b/objectivec/Tests/GPBMessageTests+Serialization.m
@@ -113,6 +113,9 @@
   // Proto3 optionals should be just like proto2, zero values also get serialized.
   //
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-DEFINE PROTO3_TEST_SERIALIZE_OPTIONAL_FIELD(FIELD, ZERO_VALUE, EXPECTED_LEN)
 //%  {  // optional##FIELD
 //%    Message3Optional *msg = [[Message3Optional alloc] init];
@@ -153,7 +156,6 @@
 //%PROTO3_TEST_SERIALIZE_OPTIONAL_FIELD(Enum, Message3Optional_Enum_Foo, 3)
 //%PDDM-EXPAND PROTO3_TEST_SERIALIZE_OPTIONAL_FIELDS()
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
   {  // optionalInt32
     Message3Optional *msg = [[Message3Optional alloc] init];
@@ -415,8 +417,9 @@
     [msg release];
   }
 
-// clang-format on
 //%PDDM-EXPAND-END PROTO3_TEST_SERIALIZE_OPTIONAL_FIELDS()
+
+// clang-format on
 }
 
 - (void)testProto2UnknownEnumToUnknownField {
@@ -520,6 +523,9 @@
   XCTAssertEqual(orig.oneofE1, UnknownEnumsMyEnumPlusExtra_EExtra);
 }
 
+// Disable clang-format for the macros.
+// clang-format off
+
 //%PDDM-DEFINE TEST_ROUNDTRIP_ONEOF(MESSAGE, FIELD, VALUE)
 //%TEST_ROUNDTRIP_ONEOF_ADV(MESSAGE, FIELD, VALUE, )
 //%PDDM-DEFINE TEST_ROUNDTRIP_ONEOF_ADV(MESSAGE, FIELD, VALUE, EQ_SUFFIX)
@@ -583,7 +589,6 @@
 //%
 //%PDDM-EXPAND TEST_ROUNDTRIP_ONEOFS(2, NO)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)testProto2RoundTripOneof {
 
@@ -814,10 +819,8 @@
   [subMessage release];
 }
 
-// clang-format on
 //%PDDM-EXPAND TEST_ROUNDTRIP_ONEOFS(3, YES)
 // This block of code is generated, do not edit it directly.
-// clang-format off
 
 - (void)testProto3RoundTripOneof {
 
@@ -1034,9 +1037,10 @@
   [subMessage release];
 }
 
-// clang-format on
 //%PDDM-EXPAND-END (2 expansions)
 
+// clang-format on
+
 - (void)testPackedUnpackedMessageParsing {
   // packed is optional, a repeated field should parse when packed or unpacked.
 
diff --git a/objectivec/Tests/GPBUtilitiesTests.m b/objectivec/Tests/GPBUtilitiesTests.m
index 5c3d36f..6a639e1 100644
--- a/objectivec/Tests/GPBUtilitiesTests.m
+++ b/objectivec/Tests/GPBUtilitiesTests.m
@@ -62,6 +62,7 @@
 
 - (void)testGPBDecodeTextFormatName {
   uint8_t decodeData[] = {
+    // clang-format off
     0x6,
     // An inlined string (first to make sure the leading null is handled
     // correctly, and with a key of zero to check that).
@@ -80,6 +81,7 @@
     //   underscore, lower + 30 (01 op), as is + 30 (00 op), as is + 13 (00 op),
     //   underscore, as is + 3 (00 op)
     0xE8, 0x07, 0x04, 0xA5, 0xA4, 0xA2, 0xBF, 0x1F, 0x0E, 0x84, 0x0,
+    // clang-format on
   };
   NSString *inputStr = @"abcdefghIJ";
 
@@ -104,10 +106,12 @@
   // An inlined string (and key of zero).
   XCTAssertEqualObjects(GPBDecodeTextFormatName(decodeData, 0, inputStr), @"zbcdefghIJ");
 
+  // clang-format off
   // Long name so multiple decode ops are needed.
   inputStr = @"longFieldNameIsLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong1000";
   XCTAssertEqualObjects(GPBDecodeTextFormatName(decodeData, 1000, inputStr),
                         @"long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_1000");
+  // clang-format on
 }
 
 - (void)testTextFormat {
@@ -141,12 +145,14 @@
   message.subEnum = self_autorelease_RetainCount;
   message.new_p.copy_p = @"foo";
 
+  // clang-format off
   NSString *expected = @"_cmd: true\n"
                        @"isProxy: true\n"
                        @"SubEnum: retainCount\n"
                        @"New {\n"
                        @"  copy: \"foo\"\n"
                        @"}\n";
+  // clang-format on
   NSString *result = GPBTextFormatForMessage(message, nil);
   XCTAssertEqualObjects(expected, result);
 }