<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/106994>106994</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Invalid space after `id` with blocks
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ilya-biryukov
</td>
</tr>
</table>
<pre>
Actual formatting (the problem is with `id`, `int` is used for illustrative purposes).
These are result of running `clang-format --style=google`:
```objc
@implementation MyClass
- (void)method {
id(^block)(ArgType *arg) = ^id _Nullable(ArgType *_Nullable arg) { return arg; };
int (^block)(ArgType *arg) = ^int(ArgType *_Nullable arg) {
return arg;
};
}
@end
```
Expected formatting (note the space after `id`):
```objc
@implementation MyClass
- (void)method {
id (^block)(ArgType *arg) = ^id _Nullable(ArgType *_Nullable arg) { return arg; };
int (^block)(ArgType *arg) = ^int(ArgType *_Nullable arg) {
return arg;
};
}
@end
```
The formatting should not differ between `id` and `int`, as both are essentially type names. I am still unsure about the exact rules governing this.
This started happening after https://github.com/llvm/llvm-project/commit/b2ac7f52fa95ccc478a478910ccd42730e8ea845 (found via `git bisect`). I don't fully understand the implications of the change and how annotations end up affecting formatting.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUVU1v4zgM_TXKhUigyHZsH3xopy0wh93T3Bf6oG3NyJIhUenk3y_kNG1mscCihz0MECA0JZHie4-UTMlOHnFgzSNrnnYy0xziYN1F7pWNl_wjnHcqmMvwoClLB2OIiySyfgImOpoR1hiUwwVsgldLM7ATt4adOBNfNtsTO_GymhOach6sczlRlGTPCGuOa0iYmOgPjD8x_vBtxoQgI0LElB1BGCFm77ecJ66d9NP-eg_Y7xNdHLLqaQphcljyVg_XOMXefkF912-umttldbigJ0k2ePjj8sXJlK7L-1LTOVjDRL8gzcEAax-vawDF3bHmWbmgfzDRM9E9xOnbZUVg4kHGiYkeWPUErHm2Bv76MzsnlcNf97274XaifYSIlKPfPNUjsPaJVR9pPcEnEnv673y30PBr4pv7Pn-xb9ChN_9A9vr5_HNFTVdy78ThAyEUhaRVagQ5EsY7dfT_I1GfAew3ZuqzRL331z1TaQ7ZGfCBwNhxxAgK6RXRv3MF0puPVi59LROoQPPWpJgSerLSuQtQKcXLBdMBvoJcIJF1DrJPOSJIFTJtisCfUhPE7DDBFM4Yt-am2ab3GWATJJKxyGqW64rbjquGZqI1FfWIFyZeJktzVgcdFiZenDvf_vZrDN9RExMvOiyLLYYSUrdjI0bZN1rruu1k3Xb9kWttatFWHDuUXd0UGseQvYGzlaX0yRIom0q4TbulPBM8Ey3BmEvp2RuMiQpUpcKiXqs36aYywIpPz9JPuKE5h1eQ3gd624HeQF5BjiPqjZUPgg47M1Smr3q5w-HYikZ0Tc_b3TwcUaqmG3WtKj32tRgbPPYnPZ6qqlaq4zs7CC5q3nNxrHnDTwduul61qpKnY4dNp4tWFmndoQB2CHHa2ZQyDkd-6vt656RCl7a3QYj7ucuEKK9FHDagVZ4Sq7mzidJHJLLkcPjqz9JZ868z4PpebL2Sdjm64dPEbrdNTLy8Xfg8iL8DAAD___ozGes">