[lld] a6755bd - [ELF] Replace global ctx with getCtx()
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 16 12:11:06 PST 2024
Author: Fangrui Song
Date: 2024-11-16T12:11:00-08:00
New Revision: a6755bdad1fb1a195841a2e803007dda029b5a6a
URL: https://github.com/llvm/llvm-project/commit/a6755bdad1fb1a195841a2e803007dda029b5a6a
DIFF: https://github.com/llvm/llvm-project/commit/a6755bdad1fb1a195841a2e803007dda029b5a6a.diff
LOG: [ELF] Replace global ctx with getCtx()
Added:
Modified:
lld/ELF/InputSection.cpp
lld/ELF/Symbols.cpp
Removed:
################################################################################
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 6114f570df3228..37758f1cb20f1e 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -309,7 +309,7 @@ std::string InputSectionBase::getLocation(uint64_t offset) const {
std::string secAndOffset =
(name + "+0x" + Twine::utohexstr(offset) + ")").str();
- std::string filename = toStr(ctx, file);
+ std::string filename = toStr(getCtx(), file);
if (Defined *d = getEnclosingFunction(offset))
return filename + ":(function " + toStr(getCtx(), *d) + ": " + secAndOffset;
@@ -347,7 +347,7 @@ std::string InputSectionBase::getObjMsg(uint64_t off) const {
// before ObjFile::initSectionsAndLocalSyms where local symbols are
// initialized.
if (Defined *d = getEnclosingSymbol(off))
- return filename + ":(" + toStr(ctx, *d) + ")" + archive;
+ return filename + ":(" + toStr(getCtx(), *d) + ")" + archive;
// If there's no symbol, print out the offset in the section.
return (filename + ":(" + name + "+0x" + utohexstr(off) + ")" + archive)
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index 2d17ce36e1e459..06c5dcd488bee7 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -295,7 +295,7 @@ void elf::printTraceSymbol(const Symbol &sym, StringRef name) {
else
s = ": definition of ";
- message(toStr(ctx, sym.file) + s + name);
+ message(toStr(sym.file->ctx, sym.file) + s + name);
}
static void recordWhyExtract(Ctx &ctx, const InputFile *reference,
More information about the llvm-commits
mailing list