[clang] [WebKit checkers] Treat a move constructor as non-trivial (PR #184986)
A. Jiang via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 6 03:23:59 PST 2026
frederick-vs-ja wrote:
I don't think the word "destruct" in the warning message is correct. In C++, a non-trivial move constructor usually empties out an object and/or objects owned by it, rather than destroy them. Moved-from objects should not be furtherly touched in most cases, and I believe users generally ignore them rather than mention them again.
However, there're cases where it's meaningful to re-assign them with new values, e.g. implementing removal of an element in the middle of a `vector`- or `deque`-like container.
Also, the current comments for `TrivialFunctionAnalysis` say:
https://github.com/llvm/llvm-project/blob/0d2c7d71744108fcfcbfb6258994da2c008314ba/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h#L166-L167
Given the move constructor of `shared_ptr` doesn't change reference count, should we also enhance the comments?
https://github.com/llvm/llvm-project/pull/184986
More information about the cfe-commits
mailing list