Skip to content

Commit a64bfd8

Browse files
committed
[lldb] Fix Disasembler build error on 32-bit systems
After changes in #145793. /home/david.spickett/llvm-project/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp:1360:49: error: non-const lvalue reference to type 'uint64_t' (aka 'unsigned long long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned int') 1360 | status = m_disasm_up->getInstruction(mc_inst, size, data, pc, llvm::nulls()); | ^~~~ /home/david.spickett/llvm-project/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:135:64: note: passing argument to parameter 'Size' here 135 | virtual DecodeStatus getInstruction(MCInst &Instr, uint64_t &Size, | ^ 1 error generated. The type used in the LLVM method we call is uin64_t so use that instead. It's overkill for what it is, but that's a separate issue if anyone cares. Also removed the unused form of GetMCInst.
1 parent b2eb7b0 commit a64bfd8

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@ class DisassemblerLLVMC::MCDisasmInstance {
5959

6060
~MCDisasmInstance() = default;
6161

62-
uint64_t GetMCInst(const uint8_t *opcode_data, size_t opcode_data_len,
63-
lldb::addr_t pc, llvm::MCInst &mc_inst) const;
6462
bool GetMCInst(const uint8_t *opcode_data, size_t opcode_data_len,
65-
lldb::addr_t pc, llvm::MCInst &mc_inst, size_t &size) const;
63+
lldb::addr_t pc, llvm::MCInst &mc_inst, uint64_t &size) const;
6664
void PrintMCInst(llvm::MCInst &mc_inst, lldb::addr_t pc,
6765
std::string &inst_string, std::string &comments_string);
6866
void SetStyle(bool use_hex_immed, HexImmediateStyle hex_style);
@@ -531,7 +529,7 @@ class InstructionLLVMC : public lldb_private::Instruction {
531529
const addr_t pc = m_address.GetFileAddress();
532530
llvm::MCInst inst;
533531

534-
size_t inst_size = 0;
532+
uint64_t inst_size = 0;
535533
m_is_valid = mc_disasm_ptr->GetMCInst(opcode_data, opcode_data_len,
536534
pc, inst, inst_size);
537535
m_opcode.Clear();
@@ -614,7 +612,7 @@ class InstructionLLVMC : public lldb_private::Instruction {
614612
const uint8_t *opcode_data = data.GetDataStart();
615613
const size_t opcode_data_len = data.GetByteSize();
616614
llvm::MCInst inst;
617-
size_t inst_size = 0;
615+
uint64_t inst_size = 0;
618616
bool valid = mc_disasm_ptr->GetMCInst(opcode_data, opcode_data_len, pc,
619617
inst, inst_size);
620618

@@ -1217,7 +1215,7 @@ class InstructionLLVMC : public lldb_private::Instruction {
12171215
const uint8_t *opcode_data = data.GetDataStart();
12181216
const size_t opcode_data_len = data.GetByteSize();
12191217
llvm::MCInst inst;
1220-
size_t inst_size = 0;
1218+
uint64_t inst_size = 0;
12211219
const bool valid = mc_disasm_ptr->GetMCInst(opcode_data, opcode_data_len,
12221220
pc, inst, inst_size);
12231221
if (!valid)
@@ -1353,7 +1351,7 @@ bool DisassemblerLLVMC::MCDisasmInstance::GetMCInst(const uint8_t *opcode_data,
13531351
size_t opcode_data_len,
13541352
lldb::addr_t pc,
13551353
llvm::MCInst &mc_inst,
1356-
size_t &size) const {
1354+
uint64_t &size) const {
13571355
llvm::ArrayRef<uint8_t> data(opcode_data, opcode_data_len);
13581356
llvm::MCDisassembler::DecodeStatus status;
13591357

0 commit comments

Comments
 (0)