[cfe-commits] r59946 - in /cfe/trunk: lib/AST/Expr.cpp test/CodeGen/staticinit.c

Anders Carlsson andersca at mac.com
Tue Nov 25 13:51:14 PST 2008


25 nov 2008 kl. 12.48 skrev Eli Friedman:

> On Tue, Nov 25, 2008 at 8:43 AM, Eli Friedman  
> <eli.friedman at gmail.com> wrote:
>> On Mon, Nov 24, 2008 at 7:55 PM, Anders Carlsson <andersca at mac.com>  
>> wrote:
>>>
>>> 24 nov 2008 kl. 13.27 skrev Eli Friedman:
>>>
>>>> On Sun, Nov 23, 2008 at 9:24 PM, Anders Carlsson  
>>>> <andersca at mac.com> wrote:
>>>>>
>>>>> +  case StringLiteralClass:
>>>>> +  case ObjCStringLiteralClass:
>>>>> +    return true;
>>>>
>>>> We shouldn't need a special-case here, I don't think... what's  
>>>> motivating
>>>> this?
>>>
>>> Just my laziness :) Since string literals are arrays,  
>>> Expr::Evaluate doesn't
>>> work on them yet - Do you think adding an ArrayExprEvaluator is  
>>> the correct
>>> way to go?
>>
>> Mmm... string literals are an unusual case; I don't think it should  
>> go
>> into Evaluate.  The only way we can run into a bare string literal is
>> an array initializer.  I guess leaving it as-is is okay.
>
> Actually, it might be better to rename isConstantExpr to
> isConstantInitializer, since that's what it really appears to be
> computing.

That sounds like a good idea, I'll do that.

We also have

bool CheckForConstantInitializer(Expr *e, QualType t);
bool CheckArithmeticConstantExpression(const Expr* e);
bool CheckAddressConstantExpression(const Expr* e);
bool CheckAddressConstantExpressionLValue(const Expr* e);

in Sema - not sure what to do about them. Can they use Evaluate?

Anders

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2415 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20081125/648263e6/attachment.bin>


More information about the cfe-commits mailing list