IR: Fix const-correctness of SwitchInst::CaseIterator and CaseHandle
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 12 Nov 2021 02:07:14 +0000 (18:07 -0800)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 12 Nov 2021 22:07:04 +0000 (14:07 -0800)
commita678c6743f536dac67b3714fd8c71dca7b1ae082
tree34a8f355760ca1d9fc02656ba86d94954833626c
parentc3edab8f781d0c3cf063ec0c675ad7bd7c3b65b8
IR: Fix const-correctness of SwitchInst::CaseIterator and CaseHandle

Fix some confusion between the two types of `const` a pointer/iterator
can have. Users of a SwitchInst::CaseIterator should not (and do not!)
manually mutate the SwitchInst::CaseHandle that tracks its internal
state. Change operator*() to return `const CaseHandle&`, remove the
non-const-qualified operator*(), and const-qualify
CaseHandle::setValue() and CaseHandle::setSuccessor().

Differential Revision: https://reviews.llvm.org/D113788
llvm/include/llvm/IR/Instructions.h