[COFF] Avoid "Body" as a local variable name.
authorRui Ueyama <ruiu@google.com>
Fri, 3 Nov 2017 22:49:02 +0000 (22:49 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 3 Nov 2017 22:49:02 +0000 (22:49 +0000)
Since SymbolBody is gone, "Body" is not a good variable name.
This patch renames or eliminates them.

llvm-svn: 317384

lld/COFF/Chunks.cpp
lld/COFF/InputFiles.cpp

index 149343a..cdace07 100644 (file)
@@ -251,8 +251,7 @@ void SectionChunk::writeTo(uint8_t *Buf) const {
     // Get the output section of the symbol for this relocation.  The output
     // section is needed to compute SECREL and SECTION relocations used in debug
     // info.
-    Symbol *Body = File->getSymbol(Rel.SymbolTableIndex);
-    Defined *Sym = cast<Defined>(Body);
+    Defined *Sym = cast<Defined>(File->getSymbol(Rel.SymbolTableIndex));
     Chunk *C = Sym->getChunk();
     OutputSection *OS = C ? C->getOutputSection() : nullptr;
 
@@ -328,8 +327,7 @@ void SectionChunk::getBaserels(std::vector<Baserel> *Res) {
     uint8_t Ty = getBaserelType(Rel);
     if (Ty == IMAGE_REL_BASED_ABSOLUTE)
       continue;
-    Symbol *Body = File->getSymbol(Rel.SymbolTableIndex);
-    if (isa<DefinedAbsolute>(Body))
+    if (isa<DefinedAbsolute>(File->getSymbol(Rel.SymbolTableIndex)))
       continue;
     Res->emplace_back(RVA + Rel.VirtualAddress, Ty);
   }
index 4b6ee47..b7f046a 100644 (file)
@@ -179,30 +179,30 @@ void ObjFile::initializeSymbols() {
   int32_t LastSectionNumber = 0;
 
   for (uint32_t I = 0; I < NumSymbols; ++I) {
-    COFFSymbolRef Sym = check(COFFObj->getSymbol(I));
+    COFFSymbolRef COFFSym = check(COFFObj->getSymbol(I));
 
     const void *AuxP = nullptr;
-    if (Sym.getNumberOfAuxSymbols())
+    if (COFFSym.getNumberOfAuxSymbols())
       AuxP = check(COFFObj->getSymbol(I + 1)).getRawPtr();
-    bool IsFirst = (LastSectionNumber != Sym.getSectionNumber());
+    bool IsFirst = (LastSectionNumber != COFFSym.getSectionNumber());
 
-    Symbol *Body = nullptr;
-    if (Sym.isUndefined()) {
-      Body = createUndefined(Sym);
-    } else if (Sym.isWeakExternal()) {
-      Body = createUndefined(Sym);
+    Symbol *Sym = nullptr;
+    if (COFFSym.isUndefined()) {
+      Sym = createUndefined(COFFSym);
+    } else if (COFFSym.isWeakExternal()) {
+      Sym = createUndefined(COFFSym);
       uint32_t TagIndex =
           static_cast<const coff_aux_weak_external *>(AuxP)->TagIndex;
-      WeakAliases.emplace_back(Body, TagIndex);
+      WeakAliases.emplace_back(Sym, TagIndex);
     } else {
-      Body = createDefined(Sym, AuxP, IsFirst);
+      Sym = createDefined(COFFSym, AuxP, IsFirst);
     }
-    if (Body) {
-      SymbolBodies.push_back(Body);
-      SparseSymbolBodies[I] = Body;
+    if (Sym) {
+      SymbolBodies.push_back(Sym);
+      SparseSymbolBodies[I] = Sym;
     }
-    I += Sym.getNumberOfAuxSymbols();
-    LastSectionNumber = Sym.getSectionNumber();
+    I += COFFSym.getNumberOfAuxSymbols();
+    LastSectionNumber = COFFSym.getSectionNumber();
   }
 
   for (auto &KV : WeakAliases) {