[cfe-dev] Refactoring MemRegion's hierarchy

Ted Kremenek kremenek at apple.com
Thu Aug 11 13:18:18 PDT 2011


On Aug 11, 2011, at 9:12 AM, Anna Zaks wrote:

> 
> On Aug 11, 2011, at 3:11 AM, Olaf Krzikalla wrote:
> 
>> Hi @clang,
>> 
>> I just stumbled over an annoying quirk in MemRegion's hierarchy. A 
>> CodeTextRegion is derived from TypedRegion but conditionlessly asserts 
>> on calls to getValueType. That doesn't seems right. The easiest way to 
>> fix it is to introduce a TypedValueRegion derived from TypedRegion and 
>> move the abstract getValueType to that new class. Then CodeTextRegion 
>> derives from TypedRegion and all other classes from TypedValueRegion. 
>> Alternatively we can rename TypedRegion to TypedLocationRegion and 
>> derive TypedRegion from that class.
> 
> Another option is to introduce LocationRegion to be a common predecessor to TypedRegion and CodeTextRegion. (I think this is the same as your second suggestion but with a shorter name.)

I think adding a new region is a good direction.  I'm not a fan of LocationRegion or TypedLocationRegion because all regions represent locations, so the name seems content free to me.

Added a new TypedValueRegion, and having the current subclasses of TypedRegion other than CodeTextRegion subclass that sounds good to me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110811/ec9d1730/attachment.html>


More information about the cfe-dev mailing list