On Jun 15, 2012, at 6:42 PM, Anna Zaks wrote:
>
> On Jun 15, 2012, at 6:28 PM, Jordan Rose wrote:
>
>> Author: jrose
>> Date: Fri Jun 15 20:28:00 2012
>> New Revision: 158587
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=158587&view=rev
>> Log:
>> [analyzer] Return an UnknownVal when we try to get the binding for a VLA.
>>
>> This happens in C++ mode right at the declaration of a struct VLA;
>> MallocChecker sees a bind and tries to get see if it's an escaping bind.
>> It's likely that our handling of this is still incomplete,
>
> Might be worth filing a bug to track this.
Thanks, filed a Radar so I remember to come back to this internally.
>>
>> - if (RTy->isArrayType())
>> - return getBindingForArray(store, R);
>> + if (RTy->isArrayType()) {
>> + if (RTy->isConstantArrayType())
>
> There seems to be no need for a nested 'if' here.
Well, isArrayType doesn't guarantee isConstantArrayType, which was the case
before. It was easier in my mind to think "is this an array? okay, what kind of
array is it?". The alternative would be something like
if (RTy->isConstantArrayType())
return getBindingForArray();
if (RTy->isArrayType())
return UnknownVal()
which does slightly MORE work in the common case of not being an array. (I'm
not sure IncompleteArrayType can never show up, either, although I don't think
we've had any bugs about it.)
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits