From fc3163b67a87e93e8beda976ccd16418ca879284 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 15 Nov 2018 18:56:49 +0000 Subject: [PATCH] [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 llvm-svn: 346979 --- llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp b/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp index 971a48c..c068d6b 100644 --- a/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp +++ b/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp @@ -68,7 +68,7 @@ extern "C" void LLVMInitializeWebAssemblyDisassembler() { createWebAssemblyDisassembler); } -static uint8_t nextByte(ArrayRef Bytes, uint64_t &Size) { +static int nextByte(ArrayRef 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]; -- 2.7.4