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

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] output-replacements-xml returns non empty content for previously formatted code with function-try-block
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-format
      </td>
    </tr>

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

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

<pre>
    Consider following C++ code with function-try-block:
```
void TestFunc(const std::string &data) try {
  do_something();
  do_something_more();
} catch (const std::exception &ex) {
 log_error(ex);
}
```

Given `.clang-format`:
```
---
Language: Cpp
KeepEmptyLinesAtTheStartOfBlocks: false
SeparateDefinitionBlocks: Always
...
```

I found that after applying code formatting to this source file, e.g. 
```
clang-format --style=file -i file.cpp
```
The following call 
```
clang-format --style=file --output-replacements-xml file.cpp
```
returns non-empty diff:
```
<?xml version='1.0'?>
<replacements xml:space='preserve' incomplete_format='false'>
<replacement offset='125' length='4'>&#13;&#10; </replacement>
</replacements>
```

As far as I understand there should be no `replacement offset` section in result if I did formatting before with the same settings. 

Investigation of that issue started [here](https://github.com/cpp-linter/cpp-linter-action/issues/250). I use clang-format 18.1.7 on Windows.


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVU-Po7gT_TTOpQQCEyAcOCSdyU-t30h7mJb22HJMAd41NrKLdOfbrwyZaTKb7sNKUcC46r3688oW3qvOINYsP7D8uBET9dbVe43vVk-0OdvmWj9Z41WDDlqrtX1TpoMnxg-MH0DaBuFNUQ_tZCQpayJy1-isrfybZXuWHFmyZ0Vy-83Li1UNvKCn02Qk4ztpjSfw1ASHbO_JBQbGi0aQYLwCcldg5WHxBmjsq7cDUq9Mx_iO8YplDzdfB-vwNwtWHkEKkj38mxnfJY4hh0CO74H6g1bb7hWds47x3by3hnyY5_L_P3VBA6xIYqmF6aLWukF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