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-boun...@lists.llvm.org] On Behalf Of Tatyana Krasnukha via lldb-dev Sent: Friday, 22 December, 2017 9:06 PM To: lldb-dev@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)?
_______________________________________________ lldb-dev mailing list lldb-dev@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev