From e5172702f47e900616c5c4b8b964bf142b79a0e5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 13 Dec 2001 00:46:11 +0000 Subject: [PATCH] Not just arrays are unsized llvm-svn: 1450 --- lib/Target/TargetData.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index 09bc6009dc8..a2383d12a2a 100644 --- a/lib/Target/TargetData.cpp +++ b/lib/Target/TargetData.cpp @@ -95,6 +95,7 @@ TargetData::~TargetData() { static inline void getTypeInfo(const Type *Ty, const TargetData *TD, unsigned &Size, unsigned char &Alignment) { + assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"); switch (Ty->getPrimitiveID()) { case Type::VoidTyID: case Type::BoolTyID: @@ -114,7 +115,6 @@ static inline void getTypeInfo(const Type *Ty, const TargetData *TD, return; case Type::ArrayTyID: { const ArrayType *ATy = (const ArrayType *)Ty; - assert(ATy->isSized() && "Can't get TypeInfo of an unsized array!"); getTypeInfo(ATy->getElementType(), TD, Size, Alignment); Size *= ATy->getNumElements(); return;