Add checks for the landingpad instruction's clause values to make sure that
authorBill Wendling <isanbard@gmail.com>
Fri, 12 Aug 2011 20:52:25 +0000 (20:52 +0000)
committerBill Wendling <isanbard@gmail.com>
Fri, 12 Aug 2011 20:52:25 +0000 (20:52 +0000)
they're the correct type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137511 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/LLParser.cpp

index 6a4c2a8fb933a5d82ee3f8eeb2641482da0fcafc..a5412a6764dabb322016e73ff0adb99cad62d80b 100644 (file)
@@ -3554,6 +3554,16 @@ bool LLParser::ParseLandingPad(Instruction *&Inst, PerFunctionState &PFS) {
       return true;
     }
 
+    // A 'catch' type expects a non-array constant. A filter clause expects an
+    // array constant.
+    if (CT == LandingPadInst::Catch) {
+      if (isa<ArrayType>(V->getType()))
+        Error(VLoc, "'catch' clause has an invalid type");
+    } else {
+      if (!isa<ArrayType>(V->getType()))
+        Error(VLoc, "'filter' clause has an invalid type");
+    }
+
     LP->addClause(V);
   }