[PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced
Victor Leschuk via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 13 12:53:36 PDT 2016
vleschuk added inline comments.
================
Comment at: lib/CodeGen/CGDebugInfo.cpp:608
@@ -608,2 +607,3 @@
uint64_t Size = CGM.getContext().getTypeSize(Ty);
+ uint64_t Align = 0;
----------------
rnk wrote:
> IMO this is what we should be doing everywhere, rather than manually checking AlignedAttr:
> TypeInfo TI = CGM.getContext().getTypeInfo(Ty);
> uint64_t Size = TI.Width;
> uint64_t Align = TI.AlignIsRequired ? TI.Align : 0;
>
> This saves a hash lookup, and handles some corner cases. AlignIsRequired is already supposed to capture whether the alignment was changed.
Will check if this works in all cases. I think it's worth putting this snippet into helper function within anon namespace.
https://reviews.llvm.org/D24426
More information about the cfe-commits
mailing list