summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Instructions.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2017-04-12 07:27:28 +0000
committerChandler Carruth <chandlerc@gmail.com>2017-04-12 07:27:28 +0000
commit927d8e610ab8d86ca007255db1dfffa4886ad659 (patch)
treeb95d69a6723e6dbe8114ce10db4272378b312b6a /llvm/lib/IR/Instructions.cpp
parent540823f6796e10518aa68ad9b97822bbcf784f92 (diff)
downloadbcm5719-llvm-927d8e610ab8d86ca007255db1dfffa4886ad659.tar.gz
bcm5719-llvm-927d8e610ab8d86ca007255db1dfffa4886ad659.zip
[IR] Redesign the case iterator in SwitchInst to actually be an iterator
and to expose a handle to represent the actual case rather than having the iterator return a reference to itself. All of this allows the iterator to be used with common STL facilities, standard algorithms, etc. Doing this exposed some missing facilities in the iterator facade that I've fixed and required some work to the actual iterator to fully support the necessary API. Differential Revision: https://reviews.llvm.org/D31548 llvm-svn: 300032
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
-rw-r--r--llvm/lib/IR/Instructions.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index d61684b5278..faa5ed078cf 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -3659,16 +3659,16 @@ void SwitchInst::addCase(ConstantInt *OnVal, BasicBlock *Dest) {
// Initialize some new operands.
assert(OpNo+1 < ReservedSpace && "Growing didn't work!");
setNumHungOffUseOperands(OpNo+2);
- CaseIt Case(this, NewCaseIdx);
+ CaseHandle Case(this, NewCaseIdx);
Case.setValue(OnVal);
Case.setSuccessor(Dest);
}
/// removeCase - This method removes the specified case and its successor
/// from the switch instruction.
-SwitchInst::CaseIt SwitchInst::removeCase(CaseIt i) {
- unsigned idx = i.getCaseIndex();
-
+SwitchInst::CaseIt SwitchInst::removeCase(CaseIt I) {
+ unsigned idx = I->getCaseIndex();
+
assert(2 + idx*2 < getNumOperands() && "Case index out of range!!!");
unsigned NumOps = getNumOperands();
OpenPOWER on IntegriCloud