From 6183a99b064b397d98297904fbd6cf00fe1f453d Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sun, 21 Dec 2008 03:44:36 +0000 Subject: Add ASTContext::getBaseElementType and use it in CodeGenFunction::EmitArraySubscriptExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61303 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 3bf6b2f809..18ccb27301 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -712,12 +712,7 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) { Idx = Builder.CreateMul(Idx, VLASize); - QualType BaseType = VAT->getElementType(); - - // Divide by the element size. - while (const VariableArrayType *AT = - getContext().getAsVariableArrayType(BaseType)) - BaseType = AT->getElementType(); + QualType BaseType = getContext().getBaseElementType(VAT); uint64_t BaseTypeSize = getContext().getTypeSize(BaseType) / 8; Idx = Builder.CreateUDiv(Idx, -- cgit v1.2.3