[llvm] [IR] Implement successors as Use iterators (PR #186616)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 14 12:39:46 PDT 2026


================
@@ -240,7 +240,7 @@ struct DOTGraphTraits<DOTFuncInfo *> : public DefaultDOTGraphTraits {
 
     // Label source of switch edges with the associated value.
     if (const SwitchInst *SI = dyn_cast<SwitchInst>(Node->getTerminator())) {
-      unsigned SuccNo = I.getSuccessorIndex();
+      unsigned SuccNo = std::distance(succ_begin(SI), I);
----------------
boomanaiden154 wrote:

https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable

We generally prefer to not use `auto` unless the type is already present somewhere else in the line (like a `static_cast`).

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


More information about the llvm-commits mailing list