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

    <tr>
        <th>Summary</th>
        <td>
            clang-format: emacs clang-format-region doesn't work (most of the times)
        </td>
    </tr>

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

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

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

<pre>
    Using the `clang-format.el` from the main-head, in 
```emacs --version 
GNU Emacs 27.2
```
Selection of code and `clang-format-region` doesn't seem to work, because (from basic debugging) the context of `temp-file` is always empty. 

Furthermore, I noticed, that the unit tests fail as well:

```emacs -Q  -batch -l ert -l ../clang-format.el  -l ../clang-format-test.el  -f ert-run-tests-batch-and-exit
Running 3 tests (2022-04-10 18:30:16+0300, selector â€˜t’)
(clang-format: success)
   passed  1/3  clang-format-buffer--buffer-encoding (0.000719 sec)
(clang-format: success)
....
first-mismatch-at 3)))
   FAILED  2/3  clang-format-buffer--end-to-end (0.017279 sec)
(clang-format: success)
   passed  3/3  clang-format-buffer--process-encoding (0.000777 sec)

Ran 3 tests, 2 results as expected, 1 unexpected (2022-04-10 18:30:16+0300, 0.077845 sec)

1 unexpected results:
   FAILED  clang-format-buffer--end-to-end
```   

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVNtu2zAM_RrnhbAhS05sP_ihXZuhwDBgG_oBsk0n2mQpkOSm_ftRdrOlQdCtgRFdKJKH51Bqbf_SPHpldhD2CMmGdVqaXTpYN8qQoaYdGJwdZ_MolUn3KPuEfwJlIGF3CbuhI8uHo-w8pOkTOq_syfz56yPczxZeZvzCZVn-QI1diC52gM72CNL0l2BShzs6EgH1Fr1JeBnAIxI0C0frfkVQLXZy8lQIr2bUrfSqgx7babejIhNez4V01gR8DjEdxQs4HtJBaYyxlQepj_LFA-2Gl-xU5Py_nRy5u9E6jNkewNigOpz5CHsZ5uCTUTRBHzwMUmmQHo6odSJuzkNdsvYNIG1l6PaQakAX4pBlCd9eCAJXDWnMt1iH6J26ycx7fgmaEqEpPquwJP8-GRM1F684iS7OOE9ZkeYM8oqwCkZ_-Sbht0wwFgv0s0rWQXLPk4oldRVOs5qIfS2LV-e4KAb4qevQ-z9HAOAgvcceIKcyBMCbStppGNClpxENNUTESpFZxhgr85qgdB_JmNFvmQ3K-ZCOyo8LKwFEPMXrc3Tbm4cv93cA_B10SHwGG4dXYHnJyw8DO6NCvJPs4Gx0u8JFWb5NuagrzUnZqBsHh37SJDN1Ij4fSMSlY3Nq1dP6_1qAkpZlVayvJH0T7DXhn5Y_I_UfbF5cDnJcdlZ9I_pa1HIVVNDYXDK73KIr78XZYxEfiVjnaP189eNlDWrEqMdqcrrZh3CYQfMtfTsV9lObdXakhdZPpyHK8ZPqpKXyforu23VRic1q31R914t1W3asxbYa8rZoC1YXGy5KVtWiW2nZovZNsr5NODd4hDkEzZP13Uo1UQJW5CxfrwuxyXKZiyIXlcBqKNbESBGfC6WziCOzbrdyzQyJ3jdPRq1I879Gai21M4hzOoovp7C3rpGHURqrV3PqZob-G28p0lQ">