<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/76740>76740</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang Tidy] performance-avoid-endl converts std::endl to '\n' even when preceded by another constant string
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
battre
</td>
</tr>
</table>
<pre>
`clang-tidy -checks=performance-avoid-endl -fix` converts `std::endl` to `'\n'` even when preceded by another constant string.
# Minimum Test case:
```
#include <iostream>
void foo() {
std::cerr << "Hello World!" << std::endl;
}
```
# Observed behavior
After running `clang-tidy -checks=performance-avoid-endl -fix main.cc` the file looks as follows:
```
#include <iostream>
void foo() {
std::cerr << "Hello World!" << '\n';
}
```
# Expected output
I think it would make sense to generate
```
#include <iostream>
void foo() {
std::cerr << "Hello World!\n";
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVE2PozgQ_TXFpZTI2AGaA4d00tHuYbWXluZscAGeGDuyTbrz70dm0pn0oedLGmkkhCXXB_VePZ4MQQ-WqIHiEYp9Juc4Ot-0MkZPWevUpYGSdUbaYRW1uuCqG6k7BhD7E_ne-Unajlby7LRakVUGV71-hZJh5-yZfAwIJQtRgdiC2KaMFIwuXQOvoNjZdJQM6UwWX0ayePLUkSKF7QWldXEkn9qFKG3EEL22wxrYHtj2-uYC_9NWT_OEzxQidjJQ-uB9Tsmuz1uJtp2ZFSGInXYhepITiKf7mgQKe-eAPwCvEarHr_eIN0AdeZ86gNghcP4PGePwk_NGAc-B87fYewbEtRFU-4-mw__bQP6cSKBRnrXz95Nt-0ge_WyttgP-xoZwktquu25ZxkjYa0NonDsGlAF7Z4x7CX8XhXdq-SF_NxafXk_URVLo5nia4334X4yjtkfUEV_cbBRO8kgYyAZK-hzIkpeR_gD2n4S-gOXfAZupRqha1DKjJq_YhudlXbNsbBjljNq64LniuSg2vO05q2UvhMxLlVeZbjjjG5YznleiFGxNUrS12EjxQGXFih42jCapzdqY87R2fsh0CDM1VVltWGZkSyYsnsH5Ir00aLHPfJPyV-08BNgwo0MM3zpEHc1iNLtUgc9aXaDY4wcqvfnHu19ncY6bEH7NM7LZm2aM8bQImx-AHwYdx7ldd24CfkiDXo_VybvP1EXghwV3AH5YoH8JAAD__7LnhW8">