[cfe-dev] codegening constants

Chris Lattner clattner at apple.com
Thu Aug 14 10:29:16 PDT 2008


On Aug 14, 2008, at 4:12 AM, Nuno Lopes wrote:

>> On Aug 13, 2008, at 8:12 PM, Eli Friedman wrote:
>>
>>> On Wed, Aug 13, 2008 at 4:17 PM, Nuno Lopes <nunoplopes at sapo.pt>   
>>> wrote:
>>>> I've noticed that currently clang's codegen isn't marking some   
>>>> consts as
>>>> llvm constants (e.g. const char[] = "foo").
>>>> The attached patch fixes just that. As it adds some methods to   
>>>> QualType and
>>>> Type classes, I'm sending to the list to get approval before   
>>>> commit. So
>>>> please comment on it! :)
>>>
>>> The getAsArrayType* methods were moved to ASTContext for a reason...
>>> you shouldn't be moving them back.
>>
>> Yep, this change should not pass the regression test suite.  Nuno,  
>> did you test it?
>
> Yes, and it does pass the whole regression test suite (minus one  
> test that was already failing).

Ok

> Also, I didn't see any method in ASTContext that is appropriate to  
> what I needed. getAsArrayType() in ASTContext are (in my  
> understanding) to make new types, not to cast a Type* into an  
> xxArrayType*.

getAsArrayType can return a different type than passed in.   
Specifically, if you ask for the array type of a "const array of int",  
you will get back an "array of const int" instead of an "array of int".

-Chris



More information about the cfe-dev mailing list