[cfe-dev] [SCA] Should the super region of the ElementRegion always be typed?

Zhongxing Xu xuzhongxing at gmail.com
Wed Feb 4 20:57:06 PST 2009


On Thu, Feb 5, 2009 at 2:19 AM, Ted Kremenek <kremenek at apple.com> wrote:

>
> On Feb 3, 2009, at 7:28 PM, Zhongxing Xu wrote:
>
>
> On Wed, Feb 4, 2009 at 11:13 AM, Zhongxing Xu <xuzhongxing at gmail.com>
> wrote:
>
>> On Wed, Feb 4, 2009 at 11:04 AM, Zhongxing Xu <xuzhongxing at gmail.com>
>> wrote:
>>
>>> Consider this code:
>>>
>>> void foo(int *p) {
>>>   p[0] = 1;
>>> }
>>>
>>> Currently we evaluate p[0] to loc::SymbolVal. I want it to be
>>> loc::MemRegionVal(ElementRegion(SymbolicRegion(SymbolRegionRValue(p)),
>>> 0)). But
>>> ElementRegion assumes its super region be typed. Is this assumption too
>>> strong?
>>
>>
>> Or, we could always know the RValue type of a symblic region?
>>
>
> How about we make SymbolicRegion subclass TypedRegion?
>
>
> Sounds great to me.
>

If we do this, it would lead to a series of changes:

To get the rvalue type of the region, we need to get the type of the symbol.
SymbolManager is required to do this: get the SymbolData by SymbolRef. The
interface need to be changed:

TypedRegion::getRValueType(ASTContext&) ->
TypedRegion::getRValueType(ASTContext&, SymbolManager&)

But this is not desired for other typed regions.

Or, we can make getRValueType a method of MemRegionManager. But that would
need the access to MemRegionManager everywhere when we need the type of the
region.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090205/d9fdcbb7/attachment.html>


More information about the cfe-dev mailing list