mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-18 12:29:21 +00:00
Tighten up error checking of args.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34493 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
735b6f8cc3
commit
cbfdb7b871
@ -2104,26 +2104,27 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
|||||||
|
|
||||||
if (MMI) {
|
if (MMI) {
|
||||||
// Inform the MachineModuleInfo of the personality for this landing pad.
|
// Inform the MachineModuleInfo of the personality for this landing pad.
|
||||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(I.getOperand(2))) {
|
ConstantExpr *CE = dyn_cast<ConstantExpr>(I.getOperand(2));
|
||||||
if (CE->getOpcode() == Instruction::BitCast) {
|
assert(CE && CE->getOpcode() == Instruction::BitCast &&
|
||||||
MMI->addPersonality(CurMBB,
|
isa<Function>(CE->getOperand(0)) &&
|
||||||
cast<Function>(CE->getOperand(0)));
|
"Personality should be a function");
|
||||||
}
|
MMI->addPersonality(CurMBB, cast<Function>(CE->getOperand(0)));
|
||||||
}
|
|
||||||
|
|
||||||
// Gather all the type infos for this landing pad and pass them along to
|
// Gather all the type infos for this landing pad and pass them along to
|
||||||
// MachineModuleInfo.
|
// MachineModuleInfo.
|
||||||
std::vector<GlobalVariable *> TyInfo;
|
std::vector<GlobalVariable *> TyInfo;
|
||||||
for (unsigned i = 3, N = I.getNumOperands(); i < N; ++i) {
|
for (unsigned i = 3, N = I.getNumOperands(); i < N; ++i) {
|
||||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(I.getOperand(i))) {
|
ConstantExpr *CE = dyn_cast<ConstantExpr>(I.getOperand(i));
|
||||||
if (CE->getOpcode() == Instruction::BitCast) {
|
if (CE && CE->getOpcode() == Instruction::BitCast &&
|
||||||
|
isa<GlobalVariable>(CE->getOperand(0))) {
|
||||||
TyInfo.push_back(cast<GlobalVariable>(CE->getOperand(0)));
|
TyInfo.push_back(cast<GlobalVariable>(CE->getOperand(0)));
|
||||||
continue;
|
} else {
|
||||||
}
|
ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand(i));
|
||||||
}
|
assert(CI && CI->getZExtValue() == 0 &&
|
||||||
|
"TypeInfo must be a global variable typeinfo or NULL");
|
||||||
TyInfo.push_back(NULL);
|
TyInfo.push_back(NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
MMI->addCatchTypeInfo(CurMBB, TyInfo);
|
MMI->addCatchTypeInfo(CurMBB, TyInfo);
|
||||||
|
|
||||||
// Mark exception selector register as live in.
|
// Mark exception selector register as live in.
|
||||||
@ -2149,10 +2150,15 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
|||||||
if (MMI) {
|
if (MMI) {
|
||||||
// Find the type id for the given typeinfo.
|
// Find the type id for the given typeinfo.
|
||||||
GlobalVariable *GV = NULL;
|
GlobalVariable *GV = NULL;
|
||||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(I.getOperand(1))) {
|
ConstantExpr *CE = dyn_cast<ConstantExpr>(I.getOperand(1));
|
||||||
if (CE->getOpcode() == Instruction::BitCast) {
|
if (CE && CE->getOpcode() == Instruction::BitCast &&
|
||||||
|
isa<GlobalVariable>(CE->getOperand(0))) {
|
||||||
GV = cast<GlobalVariable>(CE->getOperand(0));
|
GV = cast<GlobalVariable>(CE->getOperand(0));
|
||||||
}
|
} else {
|
||||||
|
ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand(1));
|
||||||
|
assert(CI && CI->getZExtValue() == 0 &&
|
||||||
|
"TypeInfo must be a global variable typeinfo or NULL");
|
||||||
|
GV = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned TypeID = MMI->getTypeIDFor(GV);
|
unsigned TypeID = MMI->getTypeIDFor(GV);
|
||||||
|
Loading…
Reference in New Issue
Block a user