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?

Jordan


On Jan 23, 2014, at 2:24 , Artyom Skrobov <[email protected]> wrote:

> Jordan, good catch that this can be combined; attaching for a review.
> 
> 
> 
> -----Original Message-----
> From: Jordan Rose [mailto:[email protected]] 
> Sent: 22 January 2014 17:21
> To: Ted Kremenek
> Cc: llvm cfe; Richard Smith; Artyom Skrobov
> Subject: Re: r199790 - Add basic checking for returning null from
> functions/methods marked 'returns_nonnull'.
> 
> Should this be combined with the check that a throwing operator new never
> returns non-null? (r199452)
> 
> 
> On Jan 21, 2014, at 22:10 , Ted Kremenek <[email protected]> wrote:
> 
>> Author: kremenek
>> Date: Wed Jan 22 00:10:28 2014
>> New Revision: 199790
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=199790&view=rev
>> Log:
>> Add basic checking for returning null from functions/methods marked
> 'returns_nonnull'.
>> 
>> This involved making CheckReturnStackAddr into a static function, which
>> is now called by a top-level return value checking routine called
>> CheckReturnValExpr.
>> 
>> Modified:
>>   cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>>   cfe/trunk/include/clang/Sema/Sema.h
>>   cfe/trunk/lib/Sema/SemaChecking.cpp
>>   cfe/trunk/lib/Sema/SemaStmt.cpp
>>   cfe/trunk/test/Sema/nonnull.c
>>   cfe/trunk/test/SemaObjC/nonnull.m

Attachment: combined-nonnull.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to