mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-28 22:24:28 +00:00
Add range for-loop iterator adapter for cases in SwitchInst.
Patch by Marcello Maggioni, reviewed by Reid Kleckner. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212163 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -2661,6 +2661,9 @@ public:
|
|||||||
assert(RHS.SI == SI && "Incompatible operators.");
|
assert(RHS.SI == SI && "Incompatible operators.");
|
||||||
return RHS.Index != Index;
|
return RHS.Index != Index;
|
||||||
}
|
}
|
||||||
|
Self &operator*() {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef CaseIteratorT<const SwitchInst, const ConstantInt, const BasicBlock>
|
typedef CaseIteratorT<const SwitchInst, const ConstantInt, const BasicBlock>
|
||||||
@ -2741,6 +2744,17 @@ public:
|
|||||||
ConstCaseIt case_end() const {
|
ConstCaseIt case_end() const {
|
||||||
return ConstCaseIt(this, getNumCases());
|
return ConstCaseIt(this, getNumCases());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// cases - iteration adapter for range-for loops.
|
||||||
|
iterator_range<CaseIt> cases() {
|
||||||
|
return iterator_range<CaseIt>(case_begin(), case_end());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// cases - iteration adapter for range-for loops.
|
||||||
|
iterator_range<ConstCaseIt> cases() const {
|
||||||
|
return iterator_range<ConstCaseIt>(case_begin(), case_end());
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns an iterator that points to the default case.
|
/// Returns an iterator that points to the default case.
|
||||||
/// Note: this iterator allows to resolve successor only. Attempt
|
/// Note: this iterator allows to resolve successor only. Attempt
|
||||||
/// to resolve case value causes an assertion.
|
/// to resolve case value causes an assertion.
|
||||||
|
Reference in New Issue
Block a user