// have the same type as the switched-on value.
Type *SwitchTy = SI.getCondition()->getType();
SmallPtrSet<ConstantInt*, 32> Constants;
- for (unsigned i = 0, e = SI.getNumCases(); i != e; ++i) {
- Assert1(SI.getCaseValue(i)->getType() == SwitchTy,
+ for (SwitchInst::CaseIt i = SI.caseBegin(), e = SI.caseEnd(); i != e; ++i) {
+ Assert1(i.getCaseValue()->getType() == SwitchTy,
"Switch constants must all be same type as switch value!", &SI);
- Assert2(Constants.insert(SI.getCaseValue(i)),
- "Duplicate integer as switch case", &SI, SI.getCaseValue(i));
+ Assert2(Constants.insert(i.getCaseValue()),
+ "Duplicate integer as switch case", &SI, i.getCaseValue());
}
visitTerminatorInst(SI);