<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/97243>97243</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-tidy: modernize-raw-string-literal wrongly removes suffix, e.g. `s` (`std::string_literals`)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
e-kwsm
</td>
</tr>
</table>
<pre>
Prepare `/tmp/a.cpp`:
```cpp
#include <string>
int main() {
using namespace std::literals::string_literals;
auto s = "id=\"0\""s;
}
```
and
```json
[ { "directory": "/tmp", "command": "clang++ -std=c++14 -c -o a.o a.cpp", "file": "a.cpp", "output": "a.o" } ]
```
```ShellSession
$ clang-tidy --version
LLVM (http://llvm.org/):
LLVM version 17.0.6
Optimized build.
$ clang-tidy --checks=modernize-raw-string-literal --fix a.cpp
1 warning generated.
a.cpp:4:12: warning: escaped string literal can be written as a raw string literal [modernize-raw-string-literal]
4 | auto s = "id=\"0\""s;
| ^~~~~~~~~~~
| R"(id="0")"
a.cpp:4:12: note: FIX-IT applied suggested code changes
clang-tidy applied 1 of 1 suggested fixes.
```
gives
```cpp
auto s = R"(id="0")";
```
which must be
```cpp
auto s = R"(id="0")"s;
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVVuvozYQ_jXDywgENpfwwENyspFW2qpVt6r6Vjn2BLzLTbZJ9uxDf3tlSEia7jlSpVoJxjPjby4efwhrdd0TVZDtINsHYnLNYCoKv15sFxwH9Vr9YmgUhhDyGNjBdSOwg4jkOHoB30K8h_j2zOPl57WLhHHdy3ZShMBfrDO6r4F_WJS6d9gJ3QPbACsRit0iR5ys7mvsRUd2FJLQOuVd8W2rHRnR2mW14P15F64AYnIDWgS-R2BMK-B7yF6AsXiZgLG7ORT7p_gfkxK9-mGOX-zQX0XZzgfvPSltSLrBvHoffIuzq6VoDNiLX8uh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