[llvm-commits] [llvm] r141313 - /llvm/trunk/lib/VMCore/Core.cpp

David Blaikie dblaikie at gmail.com
Thu Oct 6 20:25:48 PDT 2011


>
> @@ -666,6 +666,7 @@
>        default:
>            assert(false && "Unhandled Opcode.");
>     }
> +    return static_cast<LLVMOpcode>(0);
>

If you used llvm_unreachable instead of assert(false) in that default case,
then you should be able to go without the (effectively unreachable) return
here.

And/or you could skip the default entirely if your switch covers all the
values of the enum - I sent out a CR to remove all these unnecessary default
cases (in both clang & llvm) a while back but I'm not sure anyone said 'yae'
or 'nae' to it.

- David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111006/56ef1c52/attachment.html>


More information about the llvm-commits mailing list