Implement alignof for vla types.

llvm-svn: 61305
This commit is contained in:
Anders Carlsson 2008-12-21 03:48:05 +00:00
parent 40b0e50ffd
commit 3ebc7c4a0d
1 changed files with 7 additions and 2 deletions

View File

@ -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);