[cfe-dev] Refactoring MemRegion's hierarchy

Olaf Krzikalla Olaf.Krzikalla at tu-dresden.de
Thu Aug 11 03:11:38 PDT 2011


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



More information about the cfe-dev mailing list