[cfe-dev] Analyzer: Extract region-walking behavior from CallAndMessageChecker
Ted Kremenek
kremenek at apple.com
Wed Jun 23 16:31:55 PDT 2010
On Jun 23, 2010, at 4:30 PM, Ted Kremenek wrote:
>
> On Jun 23, 2010, at 12:05 AM, Jordy Rose wrote:
>
>> CallAndMessageChecker currently has a simple check to see if any of the
>> members of a pass-by-value struct are uninitialized. It handles nested
>> structs, but not structs containing arrays.
>>
>> I propose to extract this region-walking behavior out into a new class,
>> RegionWalker. This would then be the basis for the current pass-by-value
>> check and a possible new one (see below). My implementation of RegionWalker
>> is loosely modeled after RecursiveASTVisitor (see attached patch), and
>> supports both structs and arrays, and both nested.
>
> Hi Jordy,
>
> I think in principle the addition of RegionWalker is a nice refactoring, but I'm really concerned about the following:
>
> + const ElementRegion *ER = MemMgr.getElementRegion(EleTy, IndexVal, R, Ctx);
>
> This call means that we will create a new ElementRegion for accessing every single element of an array. This is really expensive. Not only will this be really slow for large constant-sized arrays, it will cause a bunch of ElementRegion objects to get generated that will stay around for the entire lifetime of the GRExprEngine object.
One other comment: explicit iteration over the array also won't work from an algorithmic standpoint once we support arrays with symbolic sizes. In this case, we'll need to query the StoreManager if we want to know "is there an element that is uninitialized", etc.
More information about the cfe-dev
mailing list