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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to