[WebAssembly] Fix return type of nextByte
authorThomas Lively <tlively@google.com>
Thu, 15 Nov 2018 18:56:49 +0000 (18:56 +0000)
committerThomas Lively <tlively@google.com>
Thu, 15 Nov 2018 18:56:49 +0000 (18:56 +0000)
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

llvm-svn: 346979

llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp

index 971a48c..c068d6b 100644 (file)
@@ -68,7 +68,7 @@ extern "C" void LLVMInitializeWebAssemblyDisassembler() {
                                          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 WebAssemblyDisassembler::getInstruction(
     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];