summaryrefslogtreecommitdiffstats
path: root/clang/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
commite0808df4a558644743f1d8756da13978457ac147 (patch)
tree85a94a145b83776cdaf924ae75408d634e012125 /clang/lib/CodeGen/CGExpr.cpp
parent118467dfb78328d9538263b668b94ed8d17e5805 (diff)
downloadbcm5719-llvm-e0808df4a558644743f1d8756da13978457ac147.tar.gz
bcm5719-llvm-e0808df4a558644743f1d8756da13978457ac147.zip
Add ASTContext::getBaseElementType and use it in CodeGenFunction::EmitArraySubscriptExpr.
llvm-svn: 61303
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 3bf6b2f8091..18ccb27301f 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/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,
OpenPOWER on IntegriCloud