mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-22 10:29:35 +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:
parent
8f9108459e
commit
90fdedc064
@ -2661,6 +2661,9 @@ public:
|
||||
assert(RHS.SI == SI && "Incompatible operators.");
|
||||
return RHS.Index != Index;
|
||||
}
|
||||
Self &operator*() {
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
typedef CaseIteratorT<const SwitchInst, const ConstantInt, const BasicBlock>
|
||||
@ -2741,6 +2744,17 @@ public:
|
||||
ConstCaseIt case_end() const {
|
||||
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.
|
||||
/// Note: this iterator allows to resolve successor only. Attempt
|
||||
/// to resolve case value causes an assertion.
|
||||
|
Loading…
Reference in New Issue
Block a user