COFF: Rename getReplacement -> repl.
The previous name was too long to my taste.
llvm-svn: 241215
diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp
index b26c43a..30a1364 100644
--- a/lld/COFF/Chunks.cpp
+++ b/lld/COFF/Chunks.cpp
@@ -58,8 +58,7 @@
// Apply relocations.
for (const coff_relocation &Rel : Relocs) {
uint8_t *Off = Buf + FileOff + Rel.VirtualAddress;
- SymbolBody *Body =
- File->getSymbolBody(Rel.SymbolTableIndex)->getReplacement();
+ SymbolBody *Body = File->getSymbolBody(Rel.SymbolTableIndex)->repl();
uint64_t S = cast<Defined>(Body)->getRVA();
uint64_t P = RVA + Rel.VirtualAddress;
switch (Rel.Type) {
@@ -98,8 +97,7 @@
// address never changes even if image is relocated.
if (Rel.Type != IMAGE_REL_AMD64_ADDR64)
continue;
- SymbolBody *Body =
- File->getSymbolBody(Rel.SymbolTableIndex)->getReplacement();
+ SymbolBody *Body = File->getSymbolBody(Rel.SymbolTableIndex)->repl();
if (Body == ImageBase)
continue;
Res->push_back(RVA + Rel.VirtualAddress);
@@ -171,9 +169,8 @@
return false;
if (R1.VirtualAddress != R2.VirtualAddress)
return false;
- SymbolBody *B1 = File->getSymbolBody(R1.SymbolTableIndex)->getReplacement();
- SymbolBody *B2 =
- X->File->getSymbolBody(R2.SymbolTableIndex)->getReplacement();
+ SymbolBody *B1 = File->getSymbolBody(R1.SymbolTableIndex)->repl();
+ SymbolBody *B2 = X->File->getSymbolBody(R2.SymbolTableIndex)->repl();
if (B1 == B2)
return true;
auto *D1 = dyn_cast<DefinedRegular>(B1);
diff --git a/lld/COFF/DLL.cpp b/lld/COFF/DLL.cpp
index 479e643..e64ca93 100644
--- a/lld/COFF/DLL.cpp
+++ b/lld/COFF/DLL.cpp
@@ -420,7 +420,7 @@
void writeTo(uint8_t *Buf) override {
for (Export &E : Config->Exports) {
- auto *D = cast<Defined>(E.Sym->getReplacement());
+ auto *D = cast<Defined>(E.Sym->repl());
write32le(Buf + FileOff + E.Ordinal * 4, D->getRVA());
}
}
diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp
index 0a7dea8..7aa662a 100644
--- a/lld/COFF/SymbolTable.cpp
+++ b/lld/COFF/SymbolTable.cpp
@@ -122,7 +122,7 @@
StringRef Name = Undef->getName();
// The weak alias may have been resovled, so check for that.
if (SymbolBody *Alias = Undef->WeakAlias) {
- if (auto *D = dyn_cast<Defined>(Alias->getReplacement())) {
+ if (auto *D = dyn_cast<Defined>(Alias->repl())) {
Sym->Body = D;
continue;
}
@@ -248,7 +248,7 @@
void SymbolTable::mangleMaybe(Undefined *U) {
if (U->WeakAlias)
return;
- if (!isa<Undefined>(U->getReplacement()))
+ if (!isa<Undefined>(U->repl()))
return;
// In Microsoft ABI, a non-member function name is mangled this way.
@@ -284,7 +284,7 @@
SymbolBody *Body = new (Alloc) Undefined(To);
if (auto EC = addSymbol(Body))
return EC;
- SymbolBody *Repl = Body->getReplacement();
+ SymbolBody *Repl = Body->repl();
if (isa<Undefined>(Repl))
return std::error_code();
Sym->Body = Repl;
@@ -380,19 +380,18 @@
// All symbols referenced by non-bitcode objects must be preserved.
for (ObjectFile *File : ObjectFiles)
for (SymbolBody *Body : File->getSymbols())
- if (auto *S = dyn_cast<DefinedBitcode>(Body->getReplacement()))
+ if (auto *S = dyn_cast<DefinedBitcode>(Body->repl()))
CG->addMustPreserveSymbol(S->getName());
// Likewise for bitcode symbols which we initially resolved to non-bitcode.
for (BitcodeFile *File : BitcodeFiles)
for (SymbolBody *Body : File->getSymbols())
- if (isa<DefinedBitcode>(Body) &&
- !isa<DefinedBitcode>(Body->getReplacement()))
+ if (isa<DefinedBitcode>(Body) && !isa<DefinedBitcode>(Body->repl()))
CG->addMustPreserveSymbol(Body->getName());
// Likewise for other symbols that must be preserved.
for (Undefined *U : Config->GCRoot)
- if (isa<DefinedBitcode>(U->getReplacement()))
+ if (isa<DefinedBitcode>(U->repl()))
CG->addMustPreserveSymbol(U->getName());
CG->setModule(BitcodeFiles[0]->releaseModule());
diff --git a/lld/COFF/Symbols.h b/lld/COFF/Symbols.h
index 86ed2b3..949d3ae 100644
--- a/lld/COFF/Symbols.h
+++ b/lld/COFF/Symbols.h
@@ -80,7 +80,7 @@
// has chosen the object among other objects having the same name,
// you can access P->Backref->Body to get the resolver's result.
void setBackref(Symbol *P) { Backref = P; }
- SymbolBody *getReplacement() { return Backref ? Backref->Body : this; }
+ SymbolBody *repl() { return Backref ? Backref->Body : this; }
// Decides which symbol should "win" in the symbol table, this or
// the Other. Returns 1 if this wins, -1 if the Other wins, or 0 if
diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp
index 7efe699..ccc6419 100644
--- a/lld/COFF/Writer.cpp
+++ b/lld/COFF/Writer.cpp
@@ -118,7 +118,7 @@
SmallVector<SectionChunk *, 256> Worklist;
for (Undefined *U : Config->GCRoot) {
- auto *D = cast<DefinedRegular>(U->getReplacement());
+ auto *D = cast<DefinedRegular>(U->repl());
if (D->isLive())
continue;
D->markLive();
@@ -137,7 +137,7 @@
// Mark all symbols listed in the relocation table for this section.
for (SymbolBody *S : SC->symbols())
- if (auto *D = dyn_cast<DefinedRegular>(S->getReplacement()))
+ if (auto *D = dyn_cast<DefinedRegular>(S->repl()))
if (!D->isLive()) {
D->markLive();
Worklist.push_back(D->getChunk());
@@ -349,7 +349,7 @@
PE->SizeOfImage = SizeOfImage;
PE->SizeOfHeaders = SizeOfHeaders;
if (!Config->NoEntry) {
- Defined *Entry = cast<Defined>(Config->Entry->getReplacement());
+ Defined *Entry = cast<Defined>(Config->Entry->repl());
PE->AddressOfEntryPoint = Entry->getRVA();
}
PE->SizeOfStackReserve = Config->StackReserve;