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

Jorge Gorbe Moya via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 8 09:04:16 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 {
----------------
slackito wrote:

It's kinda weird that the SandboxIR `CaseHandle` wraps an LLVM `CaseIt` and the SandboxIR `CaseIt` wraps an LLVM `CaseHandle`.

And then the `CaseHandle` methods have to dereference the iterator to get an LLVM CaseHandle and forward the method call, and most CaseIt methods access the iterator via `CH.LLVMCaseIt`.

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


More information about the llvm-commits mailing list