[clang-tools-extra] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 13 03:51:40 PDT 2023


PiotrZSL wrote:

Other common example from me:
```
struct SomeHeavyClass {};

std::unique_ptr<SomeHeavyClass> build();

void sendMsg()
{
    auto msgContent = build();
    Message msg;
    msg.content = std::move(*msgContent);
    send(msg);
}
```

And next one:
```
struct Info {
   virtual const std::string& getInfo();
};

struct
```

Simply moving a content of unique ptr is not an issue for me, coping big structure is.
User may want to move part of object from unique_ptr

https://github.com/llvm/llvm-project/pull/66139


More information about the cfe-commits mailing list