llvm / llvm/llvm-project

[clang-tidy] fix-it for performance-inefficient-string-concatenation

Open
#186,715 3 comments 0 reactions 1 assignee Claimed by @mirimmad View on GitHub
clang-tidy enhancement
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

performance-inefficient-string-concatenation may benefit from having a fix-it to allow transformations like

```cpp

string1 = string1 + string2;

```

to

```cpp

string1 += string2;

```

and maybe:

```cpp
string1 = string1 + "bar" + string2;
```
to

```cpp
string1.append("bar").append(string2);
```

I don't have the full grasp on which checkers are allowed to have fix-its but this one feels straightforward and side-effect free enough that can be helpful.

https://godbolt.org/z/Wdd3o7sb9

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.