[cfe-commits] [Patch] Checker for assignment of non-Boolean value to Boolean variable

Anna Zaks ganna at apple.com
Thu Dec 8 21:02:08 PST 2011


Hi Ryan,

The patch looks good.

A couple of comments:
 - The two code segments where you perform assumeDual with the subsequent analysis looks the same so it probably could be factored out into a subroutine. (The comments will suffer a bit, but I think, it would be worth it.)
 - The tests look very similar. Maybe you could add some diversity with assigning an int which was assigned to a constant, etc.
 - Most importantly, I second Ted's comment about a better diagnostic message.

Cheers,
Anna.

On Dec 7, 2011, at 5:53 PM, Ryan Govostes wrote:

> Hello,
> 
> Please find attached a new checker for the static analyzer that warns on the assignment of a non-Boolean value to a variable with a Boolean data type. It supports Boolean data types defined by C++, C99, and Objective-C as well as those in stdbool.h and MacTypes.h.
> 
> Thanks,
> Ryan Govostes
> 
> <BoolAssignmentChecker.diff>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list