[cfe-dev] Refactoring MemRegion's hierarchy

Anna Zaks ganna at apple.com
Thu Aug 11 09:12:24 PDT 2011


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.)

Anna.
 
> The other way to fix that is to introduce an artificial "code text 
> value" type. Such a type doesn't have a syntactically counterpart in 
> C++. But maybe it might be helpful somewhere else. I know this sounds 
> somewhat strange. Better ignore that idea.
> Either way we should fix the CodeTextRegion pitfall. I'd go with the 
> first apporach if noone has objections.
> 
> Best regards
> Olaf Krzikalla
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list