[llvm] [SandboxIR] Remove tight-coupling with LLVM's SwitchInst::CaseHandle (PR #167093)

via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 8 09:33:07 PST 2025


================
@@ -1884,45 +1884,96 @@ class SwitchInst : public SingleLLVMInstructionImpl<llvm::SwitchInst> {
     return cast<llvm::SwitchInst>(Val)->getNumCases();
   }
 
-  using CaseHandle =
-      llvm::SwitchInst::CaseHandleImpl<SwitchInst, ConstantInt, BasicBlock>;
-  using ConstCaseHandle =
-      llvm::SwitchInst::CaseHandleImpl<const SwitchInst, const ConstantInt,
-                                       const BasicBlock>;
-  using CaseIt = llvm::SwitchInst::CaseIteratorImpl<CaseHandle>;
-  using ConstCaseIt = llvm::SwitchInst::CaseIteratorImpl<ConstCaseHandle>;
+  class CaseIt;
+  class CaseHandle {
----------------
vporpo wrote:

Yeah it is kind of weird. I did it this way because CaseHandle is basically the main interface of the iterator, so it might as well own it. But yeah, I could change it such that the iterator is owned by CaseIt, and pass it to CaseHandle in the CaseIt functions. Let me try it out.

https://github.com/llvm/llvm-project/pull/167093


More information about the llvm-commits mailing list