[clang] [WebKit checkers] Treat a move constructor as non-trivial (PR #184986)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 6 03:01:40 PST 2026


steakhal wrote:

> > I don't understand this. For example, moving a `std::unique_ptr` does not call `operator delete`. Nor does the destruction of the destructor of such a moved-from object.
> 
> That is true. But once you've moved `std::unique_ptr`, you're not supposed to use/touch that object, or else you're doing use-after-move. For example, you're not supposed to access `x` after:
> 
> ```c++
> std::unique_ptr<Foo> x = make_unique<Foo>();
> std::unique_ptr<Foo> y = std::move(x);
> ```

Okay, so basically you are suggesting to consider it "dead". While in contrast, some objects (e.g. most STL types, containers, etc) have well-defined moved-from semantics. They usually behave as if it was default constructed.

In this sense, for the sake of the analysis I could be convinced.

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


More information about the cfe-commits mailing list