Aligning structures/members?

Is there a way to set the alignment of structure types and/or their
members? I noticed that if I use the alignas keyword in c++ that clang
introduces a bunch of [Y x i8] style padding.

From: llvmdev-bounces@cs.uiuc.edu [mailto:llvmdev-bounces@cs.uiuc.edu]
On Behalf Of edA-qa mort-ora-y
Subject: [LLVMdev] Aligning structures/members?

Is there a way to set the alignment of structure types and/or their members?

Sort of. You can set a DataLayout string, but it will affect all items of a given type, not just those inside structures. Look here for details:
http://llvm.org/docs/LangRef.html#data-layout

I noticed that if I use the alignas keyword in c++ that clang introduces a
bunch of [Y x i8] style padding.

Pretty much required in order to conform to the semantics of alignas. The only other option I'm aware of at the IR level is packed structures, where all the padding is eliminated:
http://llvm.org/docs/LangRef.html#structure-type

- Chuck