Use toString(Inputfile*) to format a file object.
authorRui Ueyama <ruiu@google.com>
Fri, 28 Apr 2017 20:00:09 +0000 (20:00 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 28 Apr 2017 20:00:09 +0000 (20:00 +0000)
llvm-svn: 301674

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

index f6ec4dd..3b92ff1 100644 (file)
@@ -123,10 +123,10 @@ std::string elf::ObjectFile<ELFT>::getLineInfo(InputSectionBase *S,
   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())
index aff5755..c082f12 100644 (file)
@@ -39,9 +39,7 @@ std::vector<InputSectionBase *> elf::InputSections;
 
 // 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>
index 17a5302..4662c48 100644 (file)
@@ -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>