[PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 12 17:21:24 PDT 2016


rnk added a subscriber: rnk.

================
Comment at: lib/CodeGen/CGDebugInfo.cpp:608
@@ -608,2 +607,3 @@
 
   uint64_t Size = CGM.getContext().getTypeSize(Ty);
+  uint64_t Align = 0;
----------------
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.


https://reviews.llvm.org/D24426





More information about the cfe-commits mailing list