[lld] r301674 - Use toString(Inputfile*) to format a file object.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 28 13:00:09 PDT 2017


Author: ruiu
Date: Fri Apr 28 15:00:09 2017
New Revision: 301674

URL: http://llvm.org/viewvc/llvm-project?rev=301674&view=rev
Log:
Use toString(Inputfile*) to format a file object.

Modified:
    lld/trunk/ELF/InputFiles.cpp
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/test/ELF/abs-conflict.s

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=301674&r1=301673&r2=301674&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Fri Apr 28 15:00:09 2017
@@ -123,10 +123,10 @@ std::string elf::ObjectFile<ELFT>::getLi
   return "";
 }
 
-// Returns "(internal)", "foo.a(bar.o)" or "baz.o".
+// Returns "<internal>", "foo.a(bar.o)" or "baz.o".
 std::string lld::toString(const InputFile *F) {
   if (!F)
-    return "(internal)";
+    return "<internal>";
 
   if (F->ToStringCache.empty()) {
     if (F->ArchiveName.empty())

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=301674&r1=301673&r2=301674&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Fri Apr 28 15:00:09 2017
@@ -39,9 +39,7 @@ std::vector<InputSectionBase *> elf::Inp
 
 // Returns a string to construct an error message.
 std::string lld::toString(const InputSectionBase *Sec) {
-  // File can be absent if section is synthetic.
-  std::string FileName = Sec->File ? Sec->File->getName() : "<internal>";
-  return (FileName + ":(" + Sec->Name + ")").str();
+  return (toString(Sec->File) + ":(" + Sec->Name + ")").str();
 }
 
 template <class ELFT>

Modified: lld/trunk/test/ELF/abs-conflict.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/abs-conflict.s?rev=301674&r1=301673&r2=301674&view=diff
==============================================================================
--- lld/trunk/test/ELF/abs-conflict.s (original)
+++ lld/trunk/test/ELF/abs-conflict.s Fri Apr 28 15:00:09 2017
@@ -15,4 +15,4 @@ foo = 0x123
 
 // DUP:      duplicate symbol: foo
 // DUP-NEXT: >>> defined in {{.*}}.o
-// DUP-NEXT: >>> defined in (internal)
+// DUP-NEXT: >>> defined in <internal>




More information about the llvm-commits mailing list