From: Eli Friedman Date: Fri, 27 Feb 2009 04:11:37 +0000 (+0000) Subject: Minor cleanup: use getDeclAlignInBytes helper. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0de40af3a3aa14e3854c0eafeabd08f6762801f9;p=clang Minor cleanup: use getDeclAlignInBytes helper. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65611 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 75a8302792..6ebe12706b 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -713,17 +713,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { 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()) - Align = std::max(Align, AA->getAlignment()); - GV->setAlignment(Align / 8); + GV->setAlignment(getContext().getDeclAlignInBytes(D)); if (const VisibilityAttr *attr = D->getAttr()) setGlobalVisibility(GV, attr->getVisibility());