[PATCH] Make analyzer check all argument for nonnull attribute

Jordan Rose jordan_rose at apple.com
Tue Oct 7 18:03:40 PDT 2014


Hi, Daniel. This is very simple, but I feel like we might as well do this nicely by tracking a set of which parameters are marked non-null by function-level attributes. llvm::SmallBitVector might be an easy way to do that, or even just a sorted SmallVector of indices.

(Thanks for doing the performance test. I believe that there's no noticeable cost right now. However, it still feels like a code smell that I'd rather not leave in.)

Jordan


> On Sep 24, 2014, at 08:46, Daniel Fahlgren <daniel at fahlgren.se> wrote:
> 
> Hi,
> 
> This patch fixes the fixme in NonNullParamChecker about multiple
> attributes. It does that by iterating over all parameters for all
> nonnull-attributes the function has.
> 
> For a function with a lot of parameters and many attributes that might
> seem a bit wasteful. However, that is likely not a problem on real code.
> I also ran some synthetic benchmarks on a worst case scenario (25
> parameters and 25 nonnull attributes) and couldn't find any noticeable
> performance issue.
> 
> Any comments or feedback?
> 
> Best regards,
> Daniel Fahlgren
> <nonnull.patch>




More information about the cfe-commits mailing list