[PATCH] D25826: [ELF] Show error location for 'undefined symbol' errors

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 25 10:41:58 PDT 2016


ruiu accepted this revision.
ruiu added a comment.

LGTM with nits.



================
Comment at: ELF/InputFiles.cpp:47
+  DwarfLine = new DWARFDebugLine(&Dwarf.getLineSection().Relocs);
+  DataExtractor lineData(Dwarf.getLineSection().Data,
+                         ELFT::TargetEndianness == support::little,
----------------
lineData -> LineData


================
Comment at: ELF/InputFiles.cpp:56
+
+template <class ELFT> DIHelper<ELFT>::~DIHelper() { delete DwarfLine; }
+
----------------
Use unique_ptr to remove this dtor.


================
Comment at: ELF/InputFiles.cpp:59-60
+template <class ELFT> std::string DIHelper<ELFT>::getLineInfo(uintX_t Offset) {
+  DILineInfo LineInfo;
+  DILineInfoSpecifier Spec;
+  if (!DwarfLine)
----------------
nit: move them after `if (!DrawfLine) return ""` so that we won't instantiate them if we return early.


================
Comment at: ELF/Relocations.cpp:574-575
 
-  std::string Msg = "undefined symbol: ";
-  Msg += Config->Demangle ? demangle(Sym.getName()) : Sym.getName().str();
+  std::string Location = getLocation(Sym, S, Offset);
+  std::string Msg =
+      "undefined symbol '" +
----------------
  std::string Msg = getLocation(...) + ": undefined symbol: '" + ...


https://reviews.llvm.org/D25826





More information about the llvm-commits mailing list