zwuis wrote: I'm -1 on adding an attribute for such a specific issue, but it's arguable.
See <https://discourse.llvm.org/t/rfc-add-a-class-attribute-clang-null-after-move-for-use-after-move-analysis/89760>. > forbidding usage not always linked with std::move. > > About conditional control flow, implementation not yet 100% complete, but it > should behave like forbidding if in any branch variable may be dropped For code deduplication, it would be better to base this on `bugprone-use-after-move`. > ... > > moveout objects: > > ```cpp > > void foo(...) { > std::vector<int> x{1, 2, 3}; > bar(std::move(x)); > use(x); // moveout object, bar(drop(x)) fixes it > } > > ``` > > ... I don't understand this example. If we change `bar(std::move(x))` to `bar(drop(x))`, `use(x)` uses `x` after it has been dropped. https://github.com/llvm/llvm-project/pull/204318 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
