[lldb-dev] Question about LLVMCDisassembler

Tatyana Krasnukha via lldb-dev lldb-dev at lists.llvm.org
Fri Dec 22 10:06:05 PST 2017


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/20171222/9749cc2a/attachment.html>


More information about the lldb-dev mailing list