Not just arrays are unsized
authorChris Lattner <sabre@nondot.org>
Thu, 13 Dec 2001 00:46:11 +0000 (00:46 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 13 Dec 2001 00:46:11 +0000 (00:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1450 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/TargetData.cpp

index 09bc6009dc81518d2c4d450919a3e8b9c62e6949..a2383d12a2a4ca0fe8e689796d510a818ad51b91 100644 (file)
@@ -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;