Skip to content

Commit ae5fdae

Browse files
committed
[ELF] Simplify printLocation
sym.file is always non-null (since around llvm#78944).
1 parent 684e79f commit ae5fdae

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

lld/ELF/Relocations.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,8 @@ using namespace llvm::support::endian;
6565
using namespace lld;
6666
using namespace lld::elf;
6767

68-
static std::optional<std::string> getLinkerScriptLocation(Ctx &ctx,
69-
const Symbol &sym) {
70-
for (SectionCommand *cmd : ctx.script->sectionCommands)
71-
if (auto *assign = dyn_cast<SymbolAssignment>(cmd))
72-
if (assign->sym == &sym)
73-
return assign->location;
74-
return std::nullopt;
75-
}
76-
7768
static void printDefinedLocation(ELFSyncStream &s, const Symbol &sym) {
78-
s << "\n>>> defined in ";
79-
if (sym.file)
80-
return void(s << sym.file);
81-
if (std::optional<std::string> loc = getLinkerScriptLocation(s.ctx, sym))
82-
return void(s << *loc);
69+
s << "\n>>> defined in " << sym.file;
8370
}
8471

8572
// Construct a message in the following format.

0 commit comments

Comments
 (0)