[lld] r256898 - Rename SharedFile::parse -> SharedFile::parseRest.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 5 17:56:37 PST 2016


Author: ruiu
Date: Tue Jan  5 19:56:36 2016
New Revision: 256898

URL: http://llvm.org/viewvc/llvm-project?rev=256898&view=rev
Log:
Rename SharedFile::parse -> SharedFile::parseRest.

Unlike ObjectFile or ArchiveFile, SharedFile had two parse functions,
parseSoName() and parse(). parse must have been called after parseSoName,
but that requirement was not obvious from their names. (So it looked
like you could call parse() on a shared object file right away.)

This patch rename parseRest. It is now obvious that there's no single
parse function for the shared object file.

Modified:
    lld/trunk/ELF/InputFiles.cpp
    lld/trunk/ELF/InputFiles.h
    lld/trunk/ELF/SymbolTable.cpp

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=256898&r1=256897&r2=256898&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Tue Jan  5 19:56:36 2016
@@ -354,6 +354,8 @@ SharedFile<ELFT>::getSection(const Elf_S
   return *Ret;
 }
 
+// Partially parse the shared object file so that we can call
+// getSoName on this object.
 template <class ELFT> void SharedFile<ELFT>::parseSoName() {
   typedef typename ELFFile<ELFT>::Elf_Dyn Elf_Dyn;
   typedef typename ELFFile<ELFT>::uintX_t uintX_t;
@@ -399,7 +401,8 @@ template <class ELFT> void SharedFile<EL
   }
 }
 
-template <class ELFT> void SharedFile<ELFT>::parse() {
+// Fully parse the shared object file. This must be called after parseSoName().
+template <class ELFT> void SharedFile<ELFT>::parseRest() {
   Elf_Sym_Range Syms = this->getNonLocalSymbols();
   uint32_t NumSymbols = std::distance(Syms.begin(), Syms.end());
   SymbolBodies.reserve(NumSymbols);

Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=256898&r1=256897&r2=256898&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Tue Jan  5 19:56:36 2016
@@ -193,7 +193,7 @@ public:
   explicit SharedFile(MemoryBufferRef M);
 
   void parseSoName();
-  void parse();
+  void parseRest();
 
   // Used for --as-needed
   bool AsNeeded = false;

Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=256898&r1=256897&r2=256898&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Tue Jan  5 19:56:36 2016
@@ -68,7 +68,7 @@ void SymbolTable<ELFT>::addFile(std::uni
       return;
 
     SharedFiles.emplace_back(cast<SharedFile<ELFT>>(File.release()));
-    F->parse();
+    F->parseRest();
     for (SharedSymbol<ELFT> &B : F->getSharedSymbols())
       resolve(&B);
     return;




More information about the llvm-commits mailing list