[lld] 113b568 - [lld][WebAssembly] Rename SymbolTable::getSymbols to match ELF backend. NFC
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 31 14:38:11 PDT 2022
Author: Sam Clegg
Date: 2022-08-31T14:33:45-07:00
New Revision: 113b5688297256c4c8c43733d511dd8493461fa5
URL: https://github.com/llvm/llvm-project/commit/113b5688297256c4c8c43733d511dd8493461fa5
DIFF: https://github.com/llvm/llvm-project/commit/113b5688297256c4c8c43733d511dd8493461fa5.diff
LOG: [lld][WebAssembly] Rename SymbolTable::getSymbols to match ELF backend. NFC
The ELF backend originally used `getSymbols()` but went though a
sequence of changes that resulted in this method being called
`symbols()`.
d8f8abbd4a2823f223bd7bc56445541fb221b512 replaced `getSymbols()` with
`forEachSymbol`.
a2fc96441788fba1e4709d63677f34ed8e321dae replaced `forEachSymbol` with
`llvm::iterator_range`.
e9262edf0d11a907763098d8e101219ccd9c43e9 replaced `llvm::iterator_range`
with `symbols()`.
Differential Revision: https://reviews.llvm.org/D131284
Added:
Modified:
lld/wasm/Driver.cpp
lld/wasm/MarkLive.cpp
lld/wasm/SymbolTable.cpp
lld/wasm/SymbolTable.h
lld/wasm/SyntheticSections.cpp
lld/wasm/Writer.cpp
Removed:
################################################################################
diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp
index 99725095c8f41..27943198c93f8 100644
--- a/lld/wasm/Driver.cpp
+++ b/lld/wasm/Driver.cpp
@@ -572,7 +572,7 @@ static void handleLibcall(StringRef name) {
// Equivalent of demote demoteSharedAndLazySymbols() in the ELF linker
static void demoteLazySymbols() {
- for (Symbol *sym : symtab->getSymbols()) {
+ for (Symbol *sym : symtab->symbols()) {
if (auto* s = dyn_cast<LazySymbol>(sym)) {
if (s->signature) {
LLVM_DEBUG(llvm::dbgs()
diff --git a/lld/wasm/MarkLive.cpp b/lld/wasm/MarkLive.cpp
index 3e5d234eeccc0..2b8c8e17787b8 100644
--- a/lld/wasm/MarkLive.cpp
+++ b/lld/wasm/MarkLive.cpp
@@ -90,7 +90,7 @@ void MarkLive::run() {
enqueue(symtab->find(config->entry));
// We need to preserve any no-strip or exported symbol
- for (Symbol *sym : symtab->getSymbols())
+ for (Symbol *sym : symtab->symbols())
if (sym->isNoStrip() || sym->isExported())
enqueue(sym);
diff --git a/lld/wasm/SymbolTable.cpp b/lld/wasm/SymbolTable.cpp
index db529312d1101..60cfd83c2e4eb 100644
--- a/lld/wasm/SymbolTable.cpp
+++ b/lld/wasm/SymbolTable.cpp
@@ -854,7 +854,7 @@ void SymbolTable::replaceWithUndefined(Symbol *sym) {
// will abort at runtime, so that relocations can still provided an operand to
// the call instruction that passes Wasm validation.
void SymbolTable::handleWeakUndefines() {
- for (Symbol *sym : getSymbols()) {
+ for (Symbol *sym : symbols()) {
if (sym->isUndefWeak() && sym->isUsedInRegularObj) {
if (sym->getSignature()) {
replaceWithUndefined(sym);
diff --git a/lld/wasm/SymbolTable.h b/lld/wasm/SymbolTable.h
index 80e2acee3808f..af90a48556c65 100644
--- a/lld/wasm/SymbolTable.h
+++ b/lld/wasm/SymbolTable.h
@@ -37,14 +37,14 @@ class InputSegment;
// There is one add* function per symbol type.
class SymbolTable {
public:
+ ArrayRef<Symbol *> symbols() const { return symVector; }
+
void wrap(Symbol *sym, Symbol *real, Symbol *wrap);
void addFile(InputFile *file);
void compileBitcodeFiles();
- ArrayRef<Symbol *> getSymbols() const { return symVector; }
-
Symbol *find(StringRef name);
void replace(StringRef name, Symbol* sym);
diff --git a/lld/wasm/SyntheticSections.cpp b/lld/wasm/SyntheticSections.cpp
index bce7c0b722781..af940efc18604 100644
--- a/lld/wasm/SyntheticSections.cpp
+++ b/lld/wasm/SyntheticSections.cpp
@@ -88,7 +88,7 @@ void DylinkSection::writeBody() {
// so that knows not to report an error for such symbols.
std::vector<const Symbol *> importInfo;
std::vector<const Symbol *> exportInfo;
- for (const Symbol *sym : symtab->getSymbols()) {
+ for (const Symbol *sym : symtab->symbols()) {
if (sym->isLive()) {
if (sym->isExported() && sym->isTLS() && isa<DefinedData>(sym)) {
exportInfo.push_back(sym);
diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp
index f98c95526c9e0..9604f52b7b0c3 100644
--- a/lld/wasm/Writer.cpp
+++ b/lld/wasm/Writer.cpp
@@ -624,7 +624,7 @@ void Writer::calculateImports() {
shouldImport(WasmSym::indirectFunctionTable))
out.importSec->addImport(WasmSym::indirectFunctionTable);
- for (Symbol *sym : symtab->getSymbols()) {
+ for (Symbol *sym : symtab->symbols()) {
if (!shouldImport(sym))
continue;
if (sym == WasmSym::indirectFunctionTable)
@@ -645,7 +645,7 @@ void Writer::calculateExports() {
unsigned globalIndex =
out.importSec->getNumImportedGlobals() + out.globalSec->numGlobals();
- for (Symbol *sym : symtab->getSymbols()) {
+ for (Symbol *sym : symtab->symbols()) {
if (!sym->isExported())
continue;
if (!sym->isLive())
@@ -689,7 +689,7 @@ void Writer::populateSymtab() {
if (!config->relocatable && !config->emitRelocs)
return;
- for (Symbol *sym : symtab->getSymbols())
+ for (Symbol *sym : symtab->symbols())
if (sym->isUsedInRegularObj && sym->isLive())
out.linkingSec->addToSymtab(sym);
@@ -743,7 +743,7 @@ void Writer::createCommandExportWrappers() {
std::vector<DefinedFunction *> toWrap;
- for (Symbol *sym : symtab->getSymbols())
+ for (Symbol *sym : symtab->symbols())
if (sym->isExported())
if (auto *f = dyn_cast<DefinedFunction>(sym))
toWrap.push_back(f);
More information about the llvm-commits
mailing list