summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-07-28 02:27:12 +0000
committerBill Wendling <isanbard@gmail.com>2011-07-28 02:27:12 +0000
commit4c93488999e930d290e6b8b9ad4dd84aaf89fb11 (patch)
tree96b8eb76174cb22b729f6a8456cc960afd1711b5 /llvm/lib
parenta8f04e303479adaf8518c27be9052453d87e1b56 (diff)
downloadbcm5719-llvm-4c93488999e930d290e6b8b9ad4dd84aaf89fb11.tar.gz
bcm5719-llvm-4c93488999e930d290e6b8b9ad4dd84aaf89fb11.zip
Make sure that the landingpad instruction takes a Constant* as the clause's value.
llvm-svn: 136326
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp7
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp2
-rw-r--r--llvm/lib/VMCore/Core.cpp2
-rw-r--r--llvm/lib/VMCore/Instructions.cpp4
4 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 547abfe24e7..b3f4d476a24 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -3528,7 +3528,7 @@ bool LLParser::ParseLandingPad(Instruction *&Inst, PerFunctionState &PFS) {
bool IsCleanup = EatIfPresent(lltok::kw_cleanup);
- SmallVector<std::pair<LandingPadInst::ClauseType, Value*>, 16> Clauses;
+ SmallVector<std::pair<LandingPadInst::ClauseType, Constant*>, 16> Clauses;
while (Lex.getKind() == lltok::kw_catch || Lex.getKind() == lltok::kw_filter){
LandingPadInst::ClauseType CT;
if (Lex.getKind() == lltok::kw_catch) {
@@ -3543,14 +3543,15 @@ bool LLParser::ParseLandingPad(Instruction *&Inst, PerFunctionState &PFS) {
Value *V; LocTy VLoc;
if (ParseTypeAndValue(V, VLoc, PFS))
return true;
- Clauses.push_back(std::make_pair(CT, V));
+ Clauses.push_back(std::make_pair(CT, cast<Constant>(V)));
} while (EatIfPresent(lltok::comma));
}
LandingPadInst *LP = LandingPadInst::Create(Ty, PersFn, Clauses.size());
LP->setCleanup(IsCleanup);
- for (SmallVectorImpl<std::pair<LandingPadInst::ClauseType, Value*> >::iterator
+ for (SmallVectorImpl<std::pair<LandingPadInst::ClauseType,
+ Constant*> >::iterator
I = Clauses.begin(), E = Clauses.end(); I != E; ++I)
LP->addClause(I->first, I->second);
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 37cc7949afe..4b83958e784 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -2550,7 +2550,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
return Error("Invalid LANDINGPAD record");
}
- LP->addClause(CT, Val);
+ LP->addClause(CT, cast<Constant>(Val));
}
I = LP;
diff --git a/llvm/lib/VMCore/Core.cpp b/llvm/lib/VMCore/Core.cpp
index 6664afc1882..5e93c73a344 100644
--- a/llvm/lib/VMCore/Core.cpp
+++ b/llvm/lib/VMCore/Core.cpp
@@ -1715,7 +1715,7 @@ void LLVMAddClause(LLVMValueRef LandingPad, LLVMLandingPadClauseTy ClauseTy,
LLVMValueRef ClauseVal) {
unwrap<LandingPadInst>(LandingPad)->
addClause(static_cast<LandingPadInst::ClauseType>(ClauseTy),
- unwrap(ClauseVal));
+ cast<Constant>(unwrap(ClauseVal)));
}
void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val) {
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp
index 9398c7f872c..968a565197c 100644
--- a/llvm/lib/VMCore/Instructions.cpp
+++ b/llvm/lib/VMCore/Instructions.cpp
@@ -228,14 +228,14 @@ void LandingPadInst::reserveClauses(unsigned Size) {
Use::zap(OldOps, OldOps + e, true);
}
-void LandingPadInst::addClause(ClauseType CT, Value *ClauseVal) {
+void LandingPadInst::addClause(ClauseType CT, Constant *ClauseVal) {
unsigned OpNo = getNumOperands();
if (OpNo + 1 > ReservedSpace)
growOperands();
assert(OpNo < ReservedSpace && "Growing didn't work!");
ClauseIdxs.push_back(CT);
++NumOperands;
- OperandList[OpNo] = ClauseVal;
+ OperandList[OpNo] = (Value*)ClauseVal;
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud