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

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] proposal for .clangformatignore
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-format,
            new-feature
      </td>
    </tr>

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

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

<pre>
    I often use clang-format to check whole trees of source code and report clang-format violations with the -n option

```bash
find . -name '*.h' -or -name '*.cpp' -exec clang-format -n {} \;
```

This works well but from time to time I have generated files I want to exclude. Mostly these are files that are autogenerated for which I have little to no control of the output

Input Source ->  Generator -> Output C++/C# code etc..

examples of such generators can be lex,yacc,bison,mild but also custom code generation phases

Sometimes these are Generators where I can place // clang-format off at the top but sometimes I simply cannot control the output enough.

There is also another use case, where for some reason on another (rightly or wrongly) clang-format simply isn't able to format the file well (either it takes a very long time, (lots of ifdef/endif) or it crash (rarer))

It would be nice in these cases to not have to contort my find command to exclude those files but to simply have a .clangformatignore file which would list the files locally that need to be ignored.

Initially, I would recommend just putting the files at the local directory level but I could see this being extended to behave similar to .gitignore with potential wildcards etc.. (subdirectories)

I think this could help greatly.




</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxkVU2P4jgQ_TXmUiJKO3yEA4dpehlxWO1h9g84TiX2tOOK7ErT_PuVndANs1IEwsTv1XuvylYx2t4jHsX2VUg53Fr8QEcjhlbdhJRi-7ZSExsKx-f_Vg21t-MFqGP0MEUE7ZTv1x2FQTEwgTao3-FqyCFwQIxAHUSagkbQ1CIo30LAkQI_7_2w5BRb8hGulg2wQVh7oDGtifJNlD-Wz105P42KZl7qrG-hgLVXA4KQeyF_FEbIPawpPK_qcczr-In6mX_tQexfxf4NxPYkqtc_yB4r-NfYCFcK7xGu6Bw0E0MXaAC2AyYT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