[lldb-dev] Question about LLVMCDisassembler
Tatyana Krasnukha via lldb-dev
lldb-dev at lists.llvm.org
Tue Dec 26 08:13:42 PST 2017
Want to answer my second question: in that case LLVMCDisassembler will be created with m_is_valid = false as it should, but what can happen in create{Target}MCAsmInfo is UB nevertheless. Suppose it is not good, that's why I created revision D41584.
From: lldb-dev [mailto:lldb-dev-bounces at lists.llvm.org] On Behalf Of Tatyana Krasnukha via lldb-dev
Sent: Friday, 22 December, 2017 9:06 PM
To: lldb-dev at lists.llvm.org
Subject: [lldb-dev] Question about LLVMCDisassembler
Hello,
Could someone answer two questions about this code, please
DisassemblerLLVMC::LLVMCDisassembler::LLVMCDisassembler starting from line 897:
m_reg_info_ap.reset(curr_target->createMCRegInfo(triple));
m_subtarget_info_ap.reset(
curr_target->createMCSubtargetInfo(triple, cpu, features_str));
std::unique_ptr<llvm::MCRegisterInfo> reg_info(
curr_target->createMCRegInfo(triple));
m_asm_info_ap.reset(curr_target->createMCAsmInfo(*reg_info, triple));
1. Why it cannot reuse m_reg_info_ap for createMCAsmInfo instead of creation reg_info again?
2. It seems that createMCRegInfo can return nullptr. Is it safe to dereference reg_info in createMCAsmInfo (line 904)?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20171226/63043941/attachment.html>
More information about the lldb-dev
mailing list