[cfe-dev] How to change byte alignment of string type?
Ryan Taylor via cfe-dev
cfe-dev at lists.llvm.org
Tue Jul 6 10:49:56 PDT 2021
Given a test case:
std::string test; // __attribute__((aligned(1)));
void foo() {
std::cout<<test<<std::endl;
return;
}
It looks like test is align 4:
@test = dso_local global %"class.std::basic_string" zeroinitializer, align 4
On Tue, Jul 6, 2021 at 12:56 PM David Blaikie <dblaikie at gmail.com> wrote:
> which string type? The alignment of the `char` type? Its size is 1, I
> don't think it's possible/reasonable to have an alignment greater than the
> size of the type (because then how do you have an array of such types?)
>
> On Tue, Jul 6, 2021 at 9:03 AM Ryan Taylor via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> How would I change the byte alignment of the string type from 1 byte to 4
>> bytes? I have little/no experience in that side of clang.
>>
>> Thanks,
>>
>> Ryan
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210706/2c02579b/attachment.html>
More information about the cfe-dev
mailing list