[lld] r244697 - Move more code that is local to Writer.cpp to an anonymous namespace.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 16:22:24 PDT 2015


Author: rafael
Date: Tue Aug 11 18:22:24 2015
New Revision: 244697

URL: http://llvm.org/viewvc/llvm-project?rev=244697&view=rev
Log:
Move more code that is local to Writer.cpp to an anonymous namespace.

Modified:
    lld/trunk/ELF/Chunks.h
    lld/trunk/ELF/Writer.cpp
    lld/trunk/ELF/Writer.h

Modified: lld/trunk/ELF/Chunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Chunks.h?rev=244697&r1=244696&r2=244697&view=diff
==============================================================================
--- lld/trunk/ELF/Chunks.h (original)
+++ lld/trunk/ELF/Chunks.h Tue Aug 11 18:22:24 2015
@@ -18,7 +18,6 @@ namespace elf2 {
 
 class Defined;
 template <class ELFT> class ObjectFile;
-class OutputSection;
 
 // A Chunk represents a chunk of data that will occupy space in the
 // output (if the resolver chose that). It may or may not be backed by

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=244697&r1=244696&r2=244697&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Aug 11 18:22:24 2015
@@ -25,6 +25,30 @@ using namespace lld::elf2;
 static const int PageSize = 4096;
 
 namespace {
+// OutputSection represents a section in an output file. It's a
+// container of chunks. OutputSection and Chunk are 1:N relationship.
+// Chunks cannot belong to more than one OutputSections. The writer
+// creates multiple OutputSections and assign them unique,
+// non-overlapping file offsets and VAs.
+class OutputSection {
+public:
+  OutputSection(StringRef Name) : Name(Name), Header({}) {}
+  void setVA(uint64_t);
+  void setFileOffset(uint64_t);
+  template <class ELFT> void addSectionChunk(SectionChunk<ELFT> *C);
+  std::vector<Chunk *> &getChunks() { return Chunks; }
+  template <class ELFT>
+  void writeHeaderTo(llvm::object::Elf_Shdr_Impl<ELFT> *SHdr);
+
+  // Returns the size of the section in the output file.
+  uint64_t getSize() { return Header.sh_size; }
+
+private:
+  StringRef Name;
+  llvm::ELF::Elf64_Shdr Header;
+  std::vector<Chunk *> Chunks;
+};
+
 // The writer writes a SymbolTable result to a file.
 template <class ELFT> class Writer {
 public:
@@ -55,30 +79,6 @@ private:
 namespace lld {
 namespace elf2 {
 
-// OutputSection represents a section in an output file. It's a
-// container of chunks. OutputSection and Chunk are 1:N relationship.
-// Chunks cannot belong to more than one OutputSections. The writer
-// creates multiple OutputSections and assign them unique,
-// non-overlapping file offsets and VAs.
-class OutputSection {
-public:
-  OutputSection(StringRef Name) : Name(Name), Header({}) {}
-  void setVA(uint64_t);
-  void setFileOffset(uint64_t);
-  template <class ELFT> void addSectionChunk(SectionChunk<ELFT> *C);
-  std::vector<Chunk *> &getChunks() { return Chunks; }
-  template <class ELFT>
-  void writeHeaderTo(llvm::object::Elf_Shdr_Impl<ELFT> *SHdr);
-
-  // Returns the size of the section in the output file.
-  uint64_t getSize() { return Header.sh_size; }
-
-private:
-  StringRef Name;
-  llvm::ELF::Elf64_Shdr Header;
-  std::vector<Chunk *> Chunks;
-};
-
 template <class ELFT>
 void writeResult(SymbolTable *Symtab) { Writer<ELFT>(Symtab).run(); }
 

Modified: lld/trunk/ELF/Writer.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.h?rev=244697&r1=244696&r2=244697&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.h (original)
+++ lld/trunk/ELF/Writer.h Tue Aug 11 18:22:24 2015
@@ -13,7 +13,6 @@
 namespace lld {
 namespace elf2 {
 
-class OutputSection;
 class SymbolTable;
 
 template <class ELFT>




More information about the llvm-commits mailing list