summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
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
commit76dbc0423e17482111784128b686b5d31a23cdab (patch)
tree5ea53422517583463f2b9cbd9f014db58ee5c702 /clang/lib/CodeGen
parent303a6d4f11698e5ce6f6acd479b3699315cf050c (diff)
downloadbcm5719-llvm-76dbc0423e17482111784128b686b5d31a23cdab.tar.gz
bcm5719-llvm-76dbc0423e17482111784128b686b5d31a23cdab.zip
Make sure to emit the size expression for sizeof(type)
llvm-svn: 61301
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGExprScalar.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index 4984d0df355..d829facb16d 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/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");
}
OpenPOWER on IntegriCloud