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

Artyom Skrobov Artyom.Skrobov at arm.com
Fri Jan 24 03:34:34 PST 2014


Thank you Richard and Jordan - committed as r199989, together with a new
test case for the isValueDependent check that was missing.

 

 

From: Jordan Rose [mailto:jordan_rose at apple.com] 
Sent: 24 January 2014 03:53
To: Richard Smith
Cc: Artyom Skrobov; Ted Kremenek; llvm cfe
Subject: Re: [PATCH] Combine the checks for returns_nonnull and for operator
new returning null, in Sema::CheckReturnValExpr

 

 

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/20140124/b3d6e4f2/attachment.html>


More information about the cfe-commits mailing list