[lld] r241215 - COFF: Rename getReplacement -> repl.

Rui Ueyama ruiu at google.com
Wed Jul 1 17:21:12 PDT 2015


Author: ruiu
Date: Wed Jul  1 19:21:11 2015
New Revision: 241215

URL: http://llvm.org/viewvc/llvm-project?rev=241215&view=rev
Log:
COFF: Rename getReplacement -> repl.

The previous name was too long to my taste.

Modified:
    lld/trunk/COFF/Chunks.cpp
    lld/trunk/COFF/DLL.cpp
    lld/trunk/COFF/SymbolTable.cpp
    lld/trunk/COFF/Symbols.h
    lld/trunk/COFF/Writer.cpp

Modified: lld/trunk/COFF/Chunks.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Chunks.cpp?rev=241215&r1=241214&r2=241215&view=diff
==============================================================================
--- lld/trunk/COFF/Chunks.cpp (original)
+++ lld/trunk/COFF/Chunks.cpp Wed Jul  1 19:21:11 2015
@@ -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::vect
     // 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 SectionC
       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);

Modified: lld/trunk/COFF/DLL.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/DLL.cpp?rev=241215&r1=241214&r2=241215&view=diff
==============================================================================
--- lld/trunk/COFF/DLL.cpp (original)
+++ lld/trunk/COFF/DLL.cpp Wed Jul  1 19:21:11 2015
@@ -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());
     }
   }

Modified: lld/trunk/COFF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.cpp?rev=241215&r1=241214&r2=241215&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.cpp (original)
+++ lld/trunk/COFF/SymbolTable.cpp Wed Jul  1 19:21:11 2015
@@ -122,7 +122,7 @@ bool SymbolTable::reportRemainingUndefin
     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(StringRe
 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(Stri
   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::creat
   // 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());

Modified: lld/trunk/COFF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Symbols.h?rev=241215&r1=241214&r2=241215&view=diff
==============================================================================
--- lld/trunk/COFF/Symbols.h (original)
+++ lld/trunk/COFF/Symbols.h Wed Jul  1 19:21:11 2015
@@ -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

Modified: lld/trunk/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=241215&r1=241214&r2=241215&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.cpp (original)
+++ lld/trunk/COFF/Writer.cpp Wed Jul  1 19:21:11 2015
@@ -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;





More information about the llvm-commits mailing list