[llvm] r310623 - Fixup for r310621: Hint the compilers about unreachable code.
Marek Sokołowski via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 10 10:23:39 PDT 2017
Thanks a lot! Yeah, it seemed quite silly to write asserts here.
Marek
10.08.2017 09:59 "Alex L" <arphaman at gmail.com> napisał(a):
> LLVM has `llvm_unreachable` for this purpose.
>
> On 10 August 2017 at 17:46, Marek Sokolowski via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: mnbvmar
>> Date: Thu Aug 10 09:46:52 2017
>> New Revision: 310623
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=310623&view=rev
>> Log:
>> Fixup for r310621: Hint the compilers about unreachable code.
>>
>> Modified:
>> llvm/trunk/tools/llvm-rc/ResourceScriptToken.cpp
>>
>> Modified: llvm/trunk/tools/llvm-rc/ResourceScriptToken.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rc
>> /ResourceScriptToken.cpp?rev=310623&r1=310622&r2=310623&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/tools/llvm-rc/ResourceScriptToken.cpp (original)
>> +++ llvm/trunk/tools/llvm-rc/ResourceScriptToken.cpp Thu Aug 10 09:46:52
>> 2017
>> @@ -214,6 +214,10 @@ Error Tokenizer::consumeToken(const Kind
>> case Kind::Invalid:
>> assert(false && "Cannot consume an invalid token.");
>> }
>> +
>> + // This silences the compilers which cannot notice that the execution
>> + // never reaches here.
>> + assert(false);
>> }
>>
>> bool Tokenizer::willNowRead(StringRef FollowingChars) const {
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170810/118ad3fa/attachment.html>
More information about the llvm-commits
mailing list