aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprScalar.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2008-12-21 03:33:21 +0000
committerAnders Carlsson <andersca@mac.com>2008-12-21 03:33:21 +0000
commitb50525ba0e996bc072cdb76152fcfe0bc64bb72a (patch)
tree8534b716aa047385dcd3e2e1be544e60e2ee8055 /lib/CodeGen/CGExprScalar.cpp
parent56a3460cf2ce104a88f6642365721f4a623e9cd5 (diff)
Make sure to emit the size expression for sizeof(type)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61301 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r--lib/CodeGen/CGExprScalar.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 4984d0df35..d829facb16 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -663,8 +663,13 @@ ScalarExprEmitter::VisitSizeOfAlignOfExpr(const SizeOfAlignOfExpr *E) {
if (const VariableArrayType *VAT =
CGF.getContext().getAsVariableArrayType(TypeToSize)) {
- if (E->isSizeOf())
+ if (E->isSizeOf()) {
+ if (E->isArgumentType()) {
+ // sizeof(type) - make sure to emit the VLA size.
+ CGF.EmitVLASize(TypeToSize);
+ }
return CGF.GetVLASize(VAT);
+ }
// FIXME: This should be an UNSUPPORTED error.
assert(0 && "alignof VLAs not implemented yet");
}