[cfe-commits] r65611 - /cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Eli Friedman eli.friedman at gmail.com
Thu Feb 26 20:11:38 PST 2009


Author: efriedma
Date: Thu Feb 26 22:11:37 2009
New Revision: 65611

URL: http://llvm.org/viewvc/llvm-project?rev=65611&view=rev
Log:
Minor cleanup: use getDeclAlignInBytes helper.


Modified:
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=65611&r1=65610&r2=65611&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Feb 26 22:11:37 2009
@@ -713,17 +713,7 @@
 
   GV->setInitializer(Init);
   GV->setConstant(D->getType().isConstant(Context));
-
-  // FIXME: This is silly; getTypeAlign should just work for incomplete arrays
-  unsigned Align;
-  if (const IncompleteArrayType* IAT =
-        Context.getAsIncompleteArrayType(D->getType()))
-    Align = Context.getTypeAlign(IAT->getElementType());
-  else
-    Align = Context.getTypeAlign(D->getType());
-  if (const AlignedAttr* AA = D->getAttr<AlignedAttr>())
-    Align = std::max(Align, AA->getAlignment());
-  GV->setAlignment(Align / 8);
+  GV->setAlignment(getContext().getDeclAlignInBytes(D));
 
   if (const VisibilityAttr *attr = D->getAttr<VisibilityAttr>())
     setGlobalVisibility(GV, attr->getVisibility());





More information about the cfe-commits mailing list