diff options
author | Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com> | 2019-12-03 09:29:54 +0530 |
---|---|---|
committer | Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com> | 2019-12-03 09:51:43 +0530 |
commit | f1e3988aa6016188c376b9bcca1afc7559f9fbc0 (patch) | |
tree | d43635bf7de1a036b7663bfbf7639817defe9200 /llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | |
parent | 3f3d0f4f4be04f2dae219c0fe76562eb01ba06d2 (diff) | |
download | bcm5719-llvm-f1e3988aa6016188c376b9bcca1afc7559f9fbc0.tar.gz bcm5719-llvm-f1e3988aa6016188c376b9bcca1afc7559f9fbc0.zip |
Recommit "[DWARF5]Addition of alignment atrribute in typedef DIE."
This revision is revised to update Go-bindings and Release Notes.
The original commit message follows.
This patch, adds support for DW_AT_alignment[DWARF5] attribute, to be emitted with typdef DIE.
When explicit alignment is specified.
Patch by Awanish Pandey <Awanish.Pandey@amd.com>
Reviewers: aprantl, dblaikie, jini.susan.george, SouraVX, alok,
deadalinx
Differential Revision: https://reviews.llvm.org/D70111
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 9d7fee1d5b3..86522a85427 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -800,6 +800,15 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const DIDerivedType *DTy) { if (!Name.empty()) addString(Buffer, dwarf::DW_AT_name, Name); + // If alignment is specified for a typedef , create and insert DW_AT_alignment + // attribute in DW_TAG_typedef DIE. + if (Tag == dwarf::DW_TAG_typedef && DD->getDwarfVersion() >= 5) { + uint32_t AlignInBytes = DTy->getAlignInBytes(); + if (AlignInBytes > 0) + addUInt(Buffer, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata, + AlignInBytes); + } + // Add size if non-zero (derived types might be zero-sized.) if (Size && Tag != dwarf::DW_TAG_pointer_type && Tag != dwarf::DW_TAG_ptr_to_member_type |