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

Matt Beaumont-Gay matthewbg at google.com
Thu Oct 6 20:47:57 PDT 2011


On Thu, Oct 6, 2011 at 20:25, David Blaikie <dblaikie at gmail.com> wrote:
>> @@ -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.

I have no strong feelings on this matter. If there is a preferred
style, it should be documented on the Coding Standards page.

-Matt




More information about the llvm-commits mailing list