NoQ added a comment. In https://reviews.llvm.org/D52983#1258499, @xazax.hun wrote:
> In https://reviews.llvm.org/D52983#1258466, @NoQ wrote: > > > Yay, these look useful. Is there also an attribute for methods that should > > never be called on a 'moved-from' object? > > > I do not know about such attribute, but once contracts are implemented and > wide-spread, a precondition on a method/function is a strong suggestion that > it should not be used on a moved-from object. Well, that actually sounds like a pretty good heuristic, as long as we know that a moved-from object cannot reliably satisfy these contracts. In other words, it'll probably be fine for most library classes, but my concern is that the more contracts do we document this way, the more false positives would we have, which is not a healthy correlation. Like, for example, if we add a contract "the object is in a consistent state" to all methods of an STL object, eg. something like `this->_length == strlen(this->_buf)` for `std::string` methods, it might be a valid contract, but all moved-from objects would trivially satisfy it (because they are guaranteed to be in a consistent albeit unspecified state), so we won't be able to all any method at all. Repository: rL LLVM https://reviews.llvm.org/D52983 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits