[PATCH] D17043: Check that the result of a library call w/o side effects is used
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 5 12:23:18 PDT 2016
On Tue, Apr 5, 2016 at 3:13 PM, Richard Smith via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> rsmith added a comment.
> The version of this attribute that was voted into the C++ standard (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0189r1.pdf) does not support a message, and I expect that is the version that libc++ will want to use.
> I think we should at least improve Clang's diagnostic message here, maybe something like:
> warning: value returned by call to function 'blah' should always be used
> note: 'blah' declared with attribute 'nodiscard' here
I think this sounds perfectly reasonable. The logic is local to
Sema::DiagnoseUnusedExprResult() IIRC, if the OP would like to take a
crack at it. Otherwise, it would be handy to file a PR so we track the
More information about the cfe-commits