[cfe-dev] EvaluateAsLValue and non global storage

Eli Friedman eli.friedman at gmail.com
Wed Aug 26 11:31:58 PDT 2009


On Wed, Aug 26, 2009 at 10:20 AM, Douglas Gregor<dgregor at apple.com> wrote:
>
> On Aug 17, 2009, at 8:54 AM, Abramo Bagnara wrote:
>> For an AST simplification application we'd need the exact same
>> services
>> of Expr::EvaluateAsLValue and other helper in ExprConstant.cpp but
>> without current failure when DeclRefExpr has not global storage.
>>
>> There's a strong reason to abort the evaluation and to not instead
>> return an LValue APValue with a non global storage base?
>>
>> This condition could be checked later from result value making the
>> service given more general.
>
>
> I was hoping that someone more familiar with the expression evaluator
> logic would chime in (Eli? Anders?). However, as I see it,
> EvaluateAsLValue could produce a value in this case but still returns
> false and sets the diagnostic to something that indicates that the
> storage is non-global.

I'm a little skeptical of the concept... it seems more suited to the
Analyzer.  I'm not strongly opposed, though.  It would be quite easy
to delay the check for whether the lvalue is a valid base from the
lvalue evaluation to the end of evaluation.

-Eli



More information about the cfe-dev mailing list