diff options
| author | Anders Carlsson <andersca@mac.com> | 2008-12-21 03:48:05 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2008-12-21 03:48:05 +0000 |
| commit | 3ebc7c4a0de329d8560c8d8ffecfae5a360e0983 (patch) | |
| tree | 908673ed864ed4c19fe1382b797c793100eb0530 | |
| parent | 40b0e50ffd6bd0a95a796798360bdb2cd1260905 (diff) | |
| download | bcm5719-llvm-3ebc7c4a0de329d8560c8d8ffecfae5a360e0983.tar.gz bcm5719-llvm-3ebc7c4a0de329d8560c8d8ffecfae5a360e0983.zip | |
Implement alignof for vla types.
llvm-svn: 61305
| -rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index d829facb16d..a5d5bc22af0 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -670,8 +670,13 @@ ScalarExprEmitter::VisitSizeOfAlignOfExpr(const SizeOfAlignOfExpr *E) { } return CGF.GetVLASize(VAT); } - // FIXME: This should be an UNSUPPORTED error. - assert(0 && "alignof VLAs not implemented yet"); + + // alignof + QualType BaseType = CGF.getContext().getBaseElementType(VAT); + uint64_t Align = CGF.getContext().getTypeAlign(BaseType); + + Align /= 8; // Return alignment in bytes, not bits. + return llvm::ConstantInt::get(llvm::APInt(ResultWidth, Align)); } std::pair<uint64_t, unsigned> Info = CGF.getContext().getTypeInfo(TypeToSize); |

