Issue |
145981
|
Summary |
[clang-tidy] Check request: readability-unnecessary-unique-release
|
Labels |
clang-tidy
|
Assignees |
|
Reporter |
denzor200
|
`std::shared_ptr`'s constructor has a lot of overloads, one of them has `unique_ptr` parameter.
People don't know about existense of that overload.
I've seen the code like this all over the place:
```
std::shared_ptr<Foo> process(std::unique_ptr<Foo> foo) {
// ...
return std::shared_ptr<Foo>(foo.release());
}
```
Need a check that will find such patterns and will change it to use constructor's overload with `unique_ptr` parameter:
```
std::shared_ptr<Foo> process(std::unique_ptr<Foo> foo) {
// ...
return std::shared_ptr<Foo>(std::move(foo));
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs