LLVM IR switch instructions always have a default: https://llvm.org/docs/LangRef.html#switch-instruction - that jumps over the body of the switch. (when lowering C code to LLVM IR the default would be put after the loop, and the breaks from any case statements would jump over that default block)
On Fri, Jul 16, 2021 at 12:34 PM Bella V via cfe-users < cfe-users@lists.llvm.org> wrote: > Hello All, > > > > I'm trying to find whether SwitchInst has a default statement. I'm able to > iterate through the case values using case_begin and case_end. If I try to > detect default using case_default which returns an iterator which points to > the default case. > > Code Example: > > case_default()->getCaseIndex() or case_default()->getSuccessorIndex() > returns the same values for both default and non-default switch C code. > > > Any suggestions to solve this problem? > > > Regards. > _______________________________________________ > cfe-users mailing list > cfe-users@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users >
_______________________________________________ cfe-users mailing list cfe-users@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users