[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:21:02 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 {
+ Context &Ctx;
+ llvm::SwitchInst::CaseIt LLVMCaseIt;
+ friend class CaseIt;
+
+ public:
+ CaseHandle(Context &Ctx, llvm::SwitchInst::CaseIt LLVMCaseIt)
+ : Ctx(Ctx), LLVMCaseIt(LLVMCaseIt) {}
+ LLVM_ABI ConstantInt *getCaseValue() const;
----------------
vporpo wrote:
These are annotations for dll shared libraries if I am not mistaken (see https://llvm.org/docs/InterfaceExportAnnotations.html#llvm-shared-library). I think it's added to declarations that are defined in the .cpp file, so `llvm::SwitchInst::CaseHandleImpl` wouldn't need them (oh and I just noticed that it's missing from getCaseValue()). Or maybe we can just ignore them and let the folks who maintain these take care of them.
https://github.com/llvm/llvm-project/pull/167093
More information about the llvm-commits
mailing list