[ELF] Replace fatal with Fatal(ctx)

This commit is contained in:
Fangrui Song 2024-11-16 15:24:53 -08:00
parent a626eb2a2f
commit ce13dd1f7e

View File

@ -37,6 +37,7 @@ class Symbol;
// Returns "<internal>", "foo.a(bar.o)" or "baz.o". // Returns "<internal>", "foo.a(bar.o)" or "baz.o".
std::string toStr(Ctx &, const InputFile *f); std::string toStr(Ctx &, const InputFile *f);
const ELFSyncStream &operator<<(const ELFSyncStream &, const InputFile *);
// Opens a given file. // Opens a given file.
std::optional<MemoryBufferRef> readFile(Ctx &, StringRef path); std::optional<MemoryBufferRef> readFile(Ctx &, StringRef path);
@ -101,7 +102,7 @@ public:
Symbol &getSymbol(uint32_t symbolIndex) const { Symbol &getSymbol(uint32_t symbolIndex) const {
assert(fileKind == ObjKind); assert(fileKind == ObjKind);
if (symbolIndex >= numSymbols) if (symbolIndex >= numSymbols)
fatal(toStr(ctx, this) + ": invalid symbol index"); Fatal(ctx) << this << ": invalid symbol index";
return *this->symbols[symbolIndex]; return *this->symbols[symbolIndex];
} }
@ -386,8 +387,6 @@ ELFFileBase *createObjFile(Ctx &, MemoryBufferRef mb,
std::string replaceThinLTOSuffix(Ctx &, StringRef path); std::string replaceThinLTOSuffix(Ctx &, StringRef path);
const ELFSyncStream &operator<<(const ELFSyncStream &, const InputFile *);
} // namespace elf } // namespace elf
} // namespace lld } // namespace lld