don't crash in some bad cases.
authorChris Lattner <sabre@nondot.org>
Wed, 23 Mar 2005 01:29:26 +0000 (01:29 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 23 Mar 2005 01:29:26 +0000 (01:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20776 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/llvmAsmParser.y

index 0e88c0189373b2c111dba1436b36b2f18b259adc..0e61b2beab6737f177bd99cf56f376da857842f5 100644 (file)
@@ -330,6 +330,9 @@ static Value *getVal(const Type *Ty, const ValID &ID) {
   Value *V = getValNonImprovising(Ty, ID);
   if (V) return V;
 
+  if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty))
+    ThrowException("Invalid use of a composite type!");
+
   // If we reached here, we referenced either a symbol that we don't know about
   // or an id number that hasn't been read yet.  We may be referencing something
   // forward, so just create an entry to be resolved later and get to it...