[PATCH] Combine the checks for returns_nonnull and for operator new returning null, in Sema::CheckReturnValExpr

Jordan Rose jordan_rose at apple.com
Thu Jan 23 19:52:59 PST 2014


On Jan 23, 2014, at 13:15 , Richard Smith <richard at metafoo.co.uk> wrote:

> On Thu, Jan 23, 2014 at 9:20 AM, Jordan Rose <jordan_rose at apple.com> wrote:
> This mostly looks good to me. One comment, though:
> 
> +          !RetValExp->isValueDependent() &&
> 
> The returns_nonnull check doesn't bother to check if it's value-dependent first. Is that necessary? Should that be folded in somewhere else?
> 
> Yes, that is necessary. If your CheckNonNullExpr is supposed to conservatively return false if the expression isn't known to be null, it should return false on any value-dependent expression.

Then we should probably sink the check there, since it's not currently doing that for the returns_nonnull attribute.

Jordan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140123/80eef2f2/attachment.html>


More information about the cfe-commits mailing list