[cfe-dev] Lazy bindings

Zhongxing Xu xuzhongxing at gmail.com
Wed Dec 17 21:43:52 PST 2008


On Thu, Dec 18, 2008 at 9:53 AM, Ted Kremenek <kremenek at apple.com> wrote:

> On Dec 17, 2008, at 4:22 AM, Zhongxing Xu wrote:
>
>  Hi Ted,
>>
>> This is the patch for lazy binding.
>>
>
> Hi Zhongxing,
>
> This is a huge patch, so I'm going to make a few passes over it.  Overall
> it looks very good.  I'm wondering if we can break out the changes to
> SymbolManager.[h,cpp] into a separate patch without compromising the current
> functionality of BasicStore.  It would also make your changes to RegionStore
> more isolated.


OK. I'll try to break it into some separate patches.


>
>
>  * failed C test cases are due to bugs in RemoveDeadBindings(),
>> which removes constraints that is still alive. I plan to fix this
>> in a later patch. This patch is already messy enough.
>>
>
> Okay.
>
>  * I wish you could help fix failed ObjC test cases, since I have
>> no access to the Mac development platform. It'll take some time for me
>> to learn basic things.
>>
>
> Sure thing.
>
>  * default value of array and struct regions are not implemented
>> yet, because the GDM of the same type of ImmutableMap<const
>> Region*, SVal> is already used for region extents.
>>
>
> You can have multiple GDM entries of the same type.  Just use a different
> GDM index and create a different "tag" type.  For example, I *believe* that
> the following should do the trick (this shows two GDM entries with the same
> map type):
>
> typedef llvm::ImmutableMap<SymbolRef, unsigned> MapTy;
>
> // TypeA.
> class TypeA {};
> static int TypeAIndex = 0;
>
> namespace clang {
>  template<>
>  struct GRStateTrait<TypeA> : public GRStatePartialTrait< MapTy > {
>    static inline void* GDMIndex() { return &TypeAIndex; }
>  };
> }
>
> // TypeB.
> static int TypeBIndex = 0;
>
> namespace clang {
>  template<>
>  struct GRStateTrait<TypeB> : public GRStatePartialTrait< MapTy > {
>    static inline void* GDMIndex() { return &TypeBIndex; }
>  };
> }
>
> I think this should work.  Basically the type used for GRStateTrait used
> for indexing into the GDM table, and we can subclass GRStatePartialTrait to
> create the rest of the methods.
>
> All of the other uses of the GDM should probably be modified to follow this
> style to avoid any accidental re-uses of the same GDM entries.


Thanks! This should work. But I prefer to do it in a later patch.


>
>
>
>>
>> * Now Bind() methods take and return GRState* because binding could
>>  also alter GDM.
>>
>
> Makes sense.
>
>
>>
>> * No variables are initialized except those declared with initial
>>  values.
>>
>
>
> Great.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20081218/c15dc794/attachment.html>


More information about the cfe-dev mailing list