<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/74784>74784</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang format fails to indent on newline if `__attribute__((...))` is present between a variable's type and its name
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
alanzhao1
</td>
</tr>
</table>
<pre>
Originally reported on https://crbug.com/1462405
Style: Chromium
clang-format version:
```sh
~/src/depot_tools/clang-format --version
clang-format version 18.0.0 (https://chromium.googlesource.com/a/external/github.com/llvm/llvm-project 10664813fca8d5ccbfd90bae9e791b7062dabd7c
```
clang-format would wrap
```objc
RenderWidgetHostViewCocoa* __attribute__((objc_precise_lifetime)) keepSelfAlive = self;
```
as
```objc
RenderWidgetHostViewCocoa* __attribute__((objc_precise_lifetime))
keepSelfAlive = self;
```
without indenting the second line. This makes it look like the two lines are separate and that `keepSelfAlive` is being assigned.
Ideally, clang-format should return something like
```objc
RenderWidgetHostViewCocoa*
__attribute__((objc_precise_lifetime)) keepSelfAlive = self;
```
This reproduces for C++ files as well, not just Objective-C.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VE2P4zYM_TXKhYghy05sH3zIZBC0pwW6RXsM9EHbmlEkQ6KTTg_97YWSLJpZ7LZAFxjAsAGLfHokH59MyY4esWebJ7Z5XsmFphB76aT_c5KhXKlg3vpP0Y7WS-feIOIcIqGB4GEimhOrdkwcmDjoqJax0OHExKGst6LmG8afGd_d3p_pzSGrdrCfYjjZ5fR4qJ3043oI8SQJzhiTDT4DP4SwLb89abr9-IuJQ4qaiYPBOdCRQnAp83jEWq-_oH33HijbghccmGi_KuhOtBhDGB2msESN9wIlEwf8gzB66Zg4jJamRd3PnDt_-aznGF5QE5R8u63bshq0bM1GazWYjiuJHTZdqRq-FUYq0-ivav1ujy5hcQYuUc7f7FFQL3eoX9AbjL9bMyL9FBL9ZvGyDzpIJnZwPEqiaNVCeDwy0TLR5szjHFHbhEdnByR7QiY6Jjp4RZw_oxt2zp4RWPUMCd3Aqqd_YS0TfAS3G-D_IXixNIWFwHqDnqwfgSaEhDp4A856LODXySY4yVdMYAlcCK_g7CteA-kSrlEJZMxps4ySEKQ3QJMkYFv-jhXbcrAJFOab7ttnikdCPxvMm8bEHt6NPE3XmUekJXpI4YQ0ZZBM5QdEcIv4CClc2xhxjsEsGhMMIcKeiScmnmCwLrcwwQWdy6X7QPCyJIJPKi-QPeN6X6xMX5mu6uQK-7LhZdeVrahXU49N2ZVSt63Sxgyaq4Zr5PVGYdXVVVWvbC-4qErBG1FVXNRFOdRDtcFhUwtVVXXFao4naV2R17YIcVzZlBbsm7pp65WTCl26mqQQj1NhQmTbjP1129UyJlZzZxOlf4DIksN-n7PgPstBWpeAwl112Uw9XrKOwA5ZM98YR1EUd63fJDRHTDlXIV0QPUg4y2ilcshEk4De5psMLSXw8oSrJbr-vcP9l20xcbh2IdvqtRF_BwAA__9a8fS1">