diff options
| author | Anders Carlsson <andersca@mac.com> | 2008-12-12 07:38:43 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2008-12-12 07:38:43 +0000 |
| commit | 5d46315ca3cbbfe0d0f5f65520b618fb05dd4446 (patch) | |
| tree | 04db544e81907424c1ee6ae2d435d5eec9a0493a /lib/CodeGen/CGExprScalar.cpp | |
| parent | bc3e9842212b78bcf49682641307e4f3419ecc5e (diff) | |
| download | clang-5d46315ca3cbbfe0d0f5f65520b618fb05dd4446.tar.gz clang-5d46315ca3cbbfe0d0f5f65520b618fb05dd4446.tar.bz2 clang-5d46315ca3cbbfe0d0f5f65520b618fb05dd4446.tar.xz | |
Implement allocation and sizeof VLAs. This is very basic for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60943 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
| -rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 7f417b374a..857a40e6c8 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -663,7 +663,14 @@ ScalarExprEmitter::VisitSizeOfAlignOfExpr(const SizeOfAlignOfExpr *E) { if (TypeToSize->isVoidType() || TypeToSize->isFunctionType()) return llvm::ConstantInt::get(llvm::APInt(ResultWidth, 1)); - /// FIXME: This doesn't handle VLAs yet! + if (const VariableArrayType *VAT = + CGF.getContext().getAsVariableArrayType(TypeToSize)) { + if (E->isSizeOf()) + return CGF.GetVLASize(VAT); + else + assert(0 && "alignof VLAs not implemented yet"); + } + std::pair<uint64_t, unsigned> Info = CGF.getContext().getTypeInfo(TypeToSize); uint64_t Val = E->isSizeOf() ? Info.first : Info.second; |
