[cfe-commits] [PATCH] A tentative implementation of RegionStoreManager
Ted Kremenek
kremenek at apple.com
Mon Oct 6 08:18:30 PDT 2008
On Oct 5, 2008, at 6:28 PM, Zhongxing Xu wrote:
> My either idea was to have regions encode minimal information that
> could be shared amongst different implementations of StoreManager.
> I'm not really certain why you wish to add a VarDecl* "pointedBy"
> field into AnonTypedRegion? I didn't get around to commenting this
> class, but AnonTypedRegion is meant to represent a typed chunk of
> memory; it doesn't have to be pointed by a VarDecl. It also seems
> to me that you are using AnonTypedRegion exactly the way BasicStore
> uses VarRegion. Isn't it the same thing? The "Anon" means
> anonymous; it means there is no name associated with this region.
>
> I use VarDecl* to differentiate AnonTypedRegions. For example, for
>
> void foo(char* a, char* b) {...},
>
> 'a' and 'b' both points to an AnonTypedRegion with type 'char', I
> just use the VarDecl's of 'a' and 'b' to differentiate these two
> regions. This is definitely not optimal design, because there might
> be AnonTypedRegion that are not pointed to by any variable. So it
> should be discussed. But one thing is sure: we need something to be
> associated with AnonTypedRegion besides its type and superregion.
I understand, but this particular use of AnonTypedRegions is exactly
the same as VarRegion. Why not just use VarRegion instead and save
the extra QualType? It also avoids putting the VarDecl* in
AnonTypedRegion, since at that point the region is not anonymous.
It seems to me that RegionStoreManager doesn't need to use just one
kind of region and one ImmutableMap. For example, a map from VarDecl*
-> VarRegion could be used for mappings from variables to regions, and
then other maps could be used for other bindings. For example, a
(MemRegion*, FieldDecl*) -> FieldRegion could be used for field
bindings. A second set of mappings could then be used for region ->
value bindings. In your prototype implementation you have
AnonTypedRegion* -> RVal, but one could also just have MemRegion* ->
RVal.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20081006/f784b3ce/attachment.html>
More information about the cfe-commits
mailing list