From 8a3ef95fc9328886779594f86077087bf87bfd3e Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Fri, 28 Apr 2017 20:00:09 +0000 Subject: [PATCH] Use toString(Inputfile*) to format a file object. llvm-svn: 301674 --- lld/ELF/InputFiles.cpp | 4 ++-- lld/ELF/InputSection.cpp | 4 +--- lld/test/ELF/abs-conflict.s | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index f6ec4dd..3b92ff1 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -123,10 +123,10 @@ std::string elf::ObjectFile::getLineInfo(InputSectionBase *S, return ""; } -// Returns "(internal)", "foo.a(bar.o)" or "baz.o". +// Returns "", "foo.a(bar.o)" or "baz.o". std::string lld::toString(const InputFile *F) { if (!F) - return "(internal)"; + return ""; if (F->ToStringCache.empty()) { if (F->ArchiveName.empty()) diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index aff5755..c082f12 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -39,9 +39,7 @@ std::vector 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() : ""; - return (FileName + ":(" + Sec->Name + ")").str(); + return (toString(Sec->File) + ":(" + Sec->Name + ")").str(); } template diff --git a/lld/test/ELF/abs-conflict.s b/lld/test/ELF/abs-conflict.s index 17a5302..4662c48 100644 --- a/lld/test/ELF/abs-conflict.s +++ b/lld/test/ELF/abs-conflict.s @@ -15,4 +15,4 @@ foo = 0x123 // DUP: duplicate symbol: foo // DUP-NEXT: >>> defined in {{.*}}.o -// DUP-NEXT: >>> defined in (internal) +// DUP-NEXT: >>> defined in -- 2.7.4