<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/82863>82863</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
adjustRemoval should not remove whitespace
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DanielJump
</td>
</tr>
</table>
<pre>
https://github.com/llvm/llvm-project/blame/bfcf7a0707592ccc7fd9e805aeb36c4da3f315a6/clang/lib/Edit/EditedSource.cpp#L337
This function causes problems because it only covers a tiny portion of whitespace removal. As such, it incorrectly removes whitespace if the end of a removal is a newline. I'm sure there are many other cases where it does the wrong or insufficient thing. The ARC code explicitly opted out of this code for similar reasons, but regular FixIts have no ability to opt-out.
I propose that this function be removed and FixIts can perform their own whitespace logic if needed and/or rely on clang-format for proper whitespace adjustments.
Note: the end of this function also injects a space, but I don't know why. The original commit doesn't appear to explain why.
If removing it is too drastic, then I propse that it returns when `end` points to the start of a line (e.g. buffer[end - 1] is \r or \n). This would work around my current issue of improper space removal.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVM1y4zgPfBr6gopKpizLPviQST5X5autPczOC0AkJGGGIlT8icdvv0Up2XWOezHLEtFodLeAMfLoiS6q_aba1x3mNEm4vKJncv_P87Lrxd4vU0pLVM2z0lelryOnKfeVkVnpq3Pvn8fTEuQnmaT0tXc4UzkHM3RYd3XXnrUxphvsmU51i9Q3R3Ow2AzNvsWj0lfj0I8FiXulr_-znD4Osn9JDoYqsyxKN380TafqV1U_b78_Jo4wZG8SiweDOVKEJUjvaI7Q0_oEOIF4dwcj7xQiICT2d1gkrFUywG3iRHFBQxBolnd0FTxHiNlMSr-UevZGQiCT3H27QvGxigdIEwF5W-DwEwW4dPN0c-ypgjeluxliDlRuBwIMBDP6O0j5DwbjCltecQIrFFfYWxA_ggRgH_MwsGHyCdLEfqzgx0Tw_P0Fj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