[cfe-commits] r59232 - /cfe/trunk/lib/Analysis/GRExprEngine.cpp

Zhongxing Xu xuzhongxing at gmail.com
Thu Nov 13 16:52:45 PST 2008

On Thu, Nov 13, 2008 at 11:45 PM, Ted Kremenek <kremenek at apple.com> wrote:

> Hi Zhongxing,
> This is a little heavy handed, but I'm actually going to revert this patch
> along with:
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20081110/009157.html
> There is a reason why MemRegion* have a const qualifier; they never can be
> changed in any way.  The const_cast itself is an indicator to me that this
> is the wrong design.  It violates the functional programming design of how
> we track state, and modifying the MemRegion object in this way can introduce
> subtle bugs.
> We'll need to iterate on this one.  We may end up applying your patch back,
> so please don't take my reverting it personally.
> Consider:
> char* p = alloca(BLOCK);
> new (p) Object1();
> ...
> new (p) Object2();
> Untyped memory can be recycled.  While this won't  occur that often, I
> think with the right design we can handle such things naturally.

I agree that another indirection is necessary, since:
 - We have no type information when creating AllocaRegion.
 - We have to attach type information to AllocaRegion.
 - Regions are immutable once created.

The question remains is that when shall we create this indirect layer. A
plausible time is when we have the type information, we create the indirect
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20081114/487216be/attachment.html>

More information about the cfe-commits mailing list