[PATCH] D34752: [LLD][ELF] Fix nullptr dereference when creating an error message.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 08:01:31 PDT 2017


ruiu added a comment.

Thank you for your patch!

Could you add a test?



================
Comment at: ELF/InputSection.cpp:279
   elf::ObjectFile<ELFT> *File = getFile<ELFT>();
   std::string Filename = File ? File->getName() : "(internal)";
 
----------------
You want to return `"(internal):" + Name + "+0x" + utohexstr(Off) +")"` here if File is null, so that you can remove the null checks below.


https://reviews.llvm.org/D34752





More information about the llvm-commits mailing list