[cfe-dev] codegening constants
Nuno Lopes
nunoplopes at sapo.pt
Thu Aug 14 11:28:39 PDT 2008
>>>>> 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".
>From my quick testing I think I was getting 'correct' results. Anyway I
include a second patch in attach that uses the methods in ASTContext. (I
dunno why I missed those on the first time..).
What do you think about this second version?
Nuno
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: clang_emit_const2.txt
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080814/80bdecc5/attachment.txt>
More information about the cfe-dev
mailing list