[cfe-commits] [PATCH] Expressions have lvalues and rvalues

Zhongxing Xu xuzhongxing at gmail.com
Wed Oct 15 06:42:36 PDT 2008


On Wed, Oct 15, 2008 at 3:34 PM, Ted Kremenek <kremenek at apple.com> wrote:

>
> On Oct 12, 2008, at 4:26 AM, Zhongxing Xu wrote:
>
>  This is consistent with C. But what we should care about is that we have
>> two kinds of evaluations of expressions: lvalue evaluation and rvalue
>> evaluation. lvalue evaluation returns the address of the object that the
>> lvalue refers to. rvalue evaluation returns the value previously assigned to
>> the object. This indicates we should have:
>>
>> AbstractVal GRExprEngine::VisitRValue(Expr* E)  (corresponds to the
>> current GRExprEngine::Visit())
>> and
>> LocVal GRExprEngine::VisitLValue(Expr*)      (corresponds to the
>> GRExprEngine::VisitLValue() in my patch)
>>
>> VisitRValue returns an AbstractValue because an expression's rvalue can
>> either be location value or non-location value. And VisitLValue() always
>> returns location value (in practice it might also return UnknownVal or
>> UndefinedVal).
>>
>
> Yep, this is exactly what we do now.  I don't know if renaming Visit to
> VisitRValue is worth it.  Probably would make the code far more
> self-documenting.


I prefer not to rename. Just having Visit and VisitLValue seems clear
enough.


>
>
>  lvalue-to-rvalue conversion
>> I think this should not bother us too much. It only indicates that we
>> should do a rvalue-evaluation of the expression.
>>
>
> Agreed.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20081015/966eb919/attachment.html>


More information about the cfe-commits mailing list