<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64817>64817</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] Adding colon after // clang-format off does not work as documented
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          fsahmad
      </td>
    </tr>
</table>

<pre>
    According to the clang-format documentation section [Disabling Formatting on a Piece of Code](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#disabling-formatting-on-a-piece-of-code) it should be possible to add an explanatory message using a colon `:` after `// clang-format off`.

This isn't working as expected, the `// clang-format off` gets ignored once you append a colon:

For example:

```c++
int formatted_code;
// clang-format off
 void    unformatted_code  ;
// clang-format on
void formatted_code_again;

// clang-format off : Explanation
    void unformatted_code  ;
// clang-format on

// clang-format off: Explanation
    void    unformatted_code  ;
// clang-format on
```

I tested this code with various versions of clang-format, ranging from 8.0.1 to 16.0.6 and the last two sections get formatted resulting in this:

```c++
int formatted_code;
// clang-format off
    void    unformatted_code  ;
// clang-format on
void formatted_code_again;

// clang-format off : Explanation
void unformatted_code;
// clang-format on

// clang-format off: Explanation
void unformatted_code;
// clang-format on
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VcGO4zYM_Rr5QsRQZDtxDj5kJg3QUwu094Us0bZaWTQkeWbn7wspyc6k2M1hFwMYcSKGfI_kEylDMKND7FjzxJpTIdc4ke-GIKdZ6qIn_dYdlSKvjRshEsQJQVnpxs1AfpYRNKl1RhdlNOQgoMpv1jydTJC9TW7n_M-YvpIDCX8aVAg0wDNpZM2JiXaKcQmsOjJxZuKcAUprX-aS_MjEWZMKTJyf0_kl2l_xzeIfSwIL5RRny0Slb4hXbglxQ24jN0tC3NCwUQlRHMBECBOtVkOPsFAIpreY8pNag3SAXxcrnYzk32DGEOSIsIaUgQRFNmW444nvjoMcIvr8O5O_Lw8NA9vxkvET48fL59-TCWCCY2If4ZX8vzlsSJioImomnnOZH0aEEWMAMzryqIGcQnijFeSyoNM3kongB-AzecCvcl4s_s-SoPKjmHhKTz41LsK1kqi_5NJVV9OPiGUjvJDRAACru3cHeBzAXWzZ_d7zixylce_ej0gAq47w27WB5hY08cmBf5LU47wfIv58Jb715SOH3yFiiKghJiHlaK8mTvAivaE1wAv6kK5FumEfoyZdeenGJLfB0wxtycttEv12V_JyB9LpLDwrQ4T4SrfbHJLY3hsCHsNq83U2LpP4XDX9ehk_RVDfFdMnSekXsG69KHRX6UN1kAV2291BVG17qPfF1Gmut_XQblsthr2ocRCIw74ZGt2ow1btCtMJLireblvBuRD7Uh6aYWj7g6h4XddcsJrjLI39NrELE8KK3a5ut_vCyh5tyAtGCIevkI1MiLRvfJd8Nv06BlZza0IM71GiiTZvpjsVNyc46ryOLoP4On5_0DpNGMDRZdCmKXvbV6iL1dvufvGMJk5rXyqamTgnHtfXZvH0D6rIxDmzT8soZ_dfAAAA__8uvUym">