aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2008-12-21 03:44:36 +0000
committerAnders Carlsson <andersca@mac.com>2008-12-21 03:44:36 +0000
commit6183a99b064b397d98297904fbd6cf00fe1f453d (patch)
treef38e16a713dceccb5c4cd68cce66cb2340fc65b3 /lib/CodeGen/CGExpr.cpp
parent0269709723e4cb0836a1a50964949e96dc0d1173 (diff)
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
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp7
1 files changed, 1 insertions, 6 deletions
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,