[llvm] r346979 - [WebAssembly] Fix return type of nextByte

Thomas Lively via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 15 10:56:50 PST 2018


Author: tlively
Date: Thu Nov 15 10:56:49 2018
New Revision: 346979

URL: http://llvm.org/viewvc/llvm-project?rev=346979&view=rev
Log:
[WebAssembly] Fix return type of nextByte

Summary:
The old return type did not allow for correct error reporting and was
causing a compiler warning.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D54586

Modified:
    llvm/trunk/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp

Modified: llvm/trunk/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp?rev=346979&r1=346978&r2=346979&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp Thu Nov 15 10:56:49 2018
@@ -68,7 +68,7 @@ extern "C" void LLVMInitializeWebAssembl
                                          createWebAssemblyDisassembler);
 }
 
-static uint8_t nextByte(ArrayRef<uint8_t> Bytes, uint64_t &Size) {
+static int nextByte(ArrayRef<uint8_t> Bytes, uint64_t &Size) {
   if (Size >= Bytes.size())
     return -1;
   auto V = Bytes[Size];
@@ -121,7 +121,7 @@ MCDisassembler::DecodeStatus WebAssembly
     raw_ostream & /*OS*/, raw_ostream &CS) const {
   CommentStream = &CS;
   Size = 0;
-  auto Opc = nextByte(Bytes, Size);
+  int Opc = nextByte(Bytes, Size);
   if (Opc < 0)
     return MCDisassembler::Fail;
   const auto *WasmInst = &InstructionTable0[Opc];




More information about the llvm-commits mailing list