mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-25 12:50:00 +00:00
Make sure that the landingpad instruction takes a Constant* as the clause's value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136326 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7f66c45f35
commit
28d735230f
@ -1852,7 +1852,7 @@ public:
|
||||
void setCleanup(bool Val) { IsCleanup = Val; }
|
||||
|
||||
/// addClause - Add a clause to the landing pad.
|
||||
void addClause(ClauseType CT, Value *ClauseVal);
|
||||
void addClause(ClauseType CT, Constant *ClauseVal);
|
||||
|
||||
/// getClauseType - Return the type of the clause at this index. The two
|
||||
/// supported clauses are Catch and Filter.
|
||||
@ -1862,9 +1862,9 @@ public:
|
||||
}
|
||||
|
||||
/// getClauseValue - Return the value of the clause at this index.
|
||||
Value *getClauseValue(unsigned I) const {
|
||||
Constant *getClauseValue(unsigned I) const {
|
||||
assert(I + 1 < getNumOperands() && "Index too large!");
|
||||
return OperandList[I + 1];
|
||||
return cast<Constant>(OperandList[I + 1]);
|
||||
}
|
||||
|
||||
/// getNumClauses - Get the number of clauses for this landing pad.
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
Loading…
Reference in New Issue
Block a user