[llvm] r190708 - Add warn_unused_result to empty() on various containers.

David Blaikie dblaikie at gmail.com
Fri Sep 13 12:27:52 PDT 2013


On Fri, Sep 13, 2013 at 11:58 AM, Benjamin Kramer <benny.kra at gmail.com>wrote:

>
> On 13.09.2013, at 20:40, David Blaikie <dblaikie at gmail.com> wrote:
>
> > This seems tedious (though I appreciate the work) - how bad would it be
> if Clang assumed const member functions with no parameters were
> warn_unused_result?
>
> Mutable members prevent using the C++ "const" keyword, I don't think it's
> feasible to turn such a warning on by default. Do we perform analysis in
> Clang to check whether a function has side effects? If so, we could use
> that.


I don't think so - which would only work for inline functions.

mutable defeats the strict correctness, certainly (or const_cast, for that
matter) but I was wondering if 'const' would indicate intent sufficiently
to get a reasonable quality warning.

I did wonder about total side-effecting functions like printing - though
less likely to return a value or be const, I suppose, though they could be
both.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130913/af32a683/attachment.html>


More information about the llvm-commits mailing list