diff options
author | Rui Ueyama <ruiu@google.com> | 2015-07-02 03:21:11 +0300 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2015-07-02 03:21:11 +0300 |
commit | 0744e87fadd7bf2258a2e39f180013fd07e93db8 (patch) | |
tree | 55f4eaf2585cc8b3686e003e0150f304c454aed5 /lld | |
parent | 18f8d2c5c06ef453e65744382db61da0b63533da (diff) |
COFF: Rename getReplacement -> repl.
The previous name was too long to my taste.
llvm-svn: 241215
Diffstat (limited to 'lld')
-rw-r--r-- | lld/COFF/Chunks.cpp | 11 | ||||
-rw-r--r-- | lld/COFF/DLL.cpp | 2 | ||||
-rw-r--r-- | lld/COFF/SymbolTable.cpp | 13 | ||||
-rw-r--r-- | lld/COFF/Symbols.h | 2 | ||||
-rw-r--r-- | lld/COFF/Writer.cpp | 6 |
5 files changed, 15 insertions, 19 deletions
diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp index b26c43aaccb4..30a1364cfe97 100644 --- a/lld/COFF/Chunks.cpp +++ b/lld/COFF/Chunks.cpp @@ -58,8 +58,7 @@ void SectionChunk::writeTo(uint8_t *Buf) { // 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 @@ void SectionChunk::getBaserels(std::vector<uint32_t> *Res, Defined *ImageBase) { // 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 @@ bool SectionChunk::equals(const SectionChunk *X) const { 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 479e643a80e5..e64ca9344819 100644 --- a/lld/COFF/DLL.cpp +++ b/lld/COFF/DLL.cpp @@ -420,7 +420,7 @@ public: 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 0a7dea8910b5..7aa662a143a6 100644 --- a/lld/COFF/SymbolTable.cpp +++ b/lld/COFF/SymbolTable.cpp @@ -122,7 +122,7 @@ bool SymbolTable::reportRemainingUndefines() { 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 @@ Symbol *SymbolTable::findSymbol(StringRef Name) { 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 @@ std::error_code SymbolTable::rename(StringRef From, StringRef To) { 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 @@ ErrorOr<ObjectFile *> SymbolTable::createLTOObject(LTOCodeGenerator *CG) { // 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 86ed2b321f0c..949d3aeb7269 100644 --- a/lld/COFF/Symbols.h +++ b/lld/COFF/Symbols.h @@ -80,7 +80,7 @@ public: // 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 7efe699419f2..ccc6419a4d61 100644 --- a/lld/COFF/Writer.cpp +++ b/lld/COFF/Writer.cpp @@ -118,7 +118,7 @@ void Writer::markLive() { 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 @@ void Writer::markLive() { // 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 @@ void Writer::writeHeader() { 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; |