[lld] r277926 - Unpollute the global namespace. lld edition.

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 6 06:52:37 PDT 2016


Author: d0k
Date: Sat Aug  6 08:52:37 2016
New Revision: 277926

URL: http://llvm.org/viewvc/llvm-project?rev=277926&view=rev
Log:
Unpollute the global namespace. lld edition.

Modified:
    lld/trunk/COFF/Librarian.cpp
    lld/trunk/ELF/MarkLive.cpp
    lld/trunk/ELF/SymbolListFile.cpp
    lld/trunk/lib/Core/Error.cpp

Modified: lld/trunk/COFF/Librarian.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Librarian.cpp?rev=277926&r1=277925&r2=277926&view=diff
==============================================================================
--- lld/trunk/COFF/Librarian.cpp (original)
+++ lld/trunk/COFF/Librarian.cpp Sat Aug  6 08:52:37 2016
@@ -54,7 +54,7 @@ static uint16_t getImgRelRelocation() {
   }
 }
 
-template <class T> void append(std::vector<uint8_t> &B, const T &Data) {
+template <class T> static void append(std::vector<uint8_t> &B, const T &Data) {
   size_t S = B.size();
   B.resize(S + sizeof(T));
   memcpy(&B[S], &Data, sizeof(T));

Modified: lld/trunk/ELF/MarkLive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MarkLive.cpp?rev=277926&r1=277925&r2=277926&view=diff
==============================================================================
--- lld/trunk/ELF/MarkLive.cpp (original)
+++ lld/trunk/ELF/MarkLive.cpp Sat Aug  6 08:52:37 2016
@@ -41,6 +41,7 @@ using namespace llvm::support::endian;
 using namespace lld;
 using namespace lld::elf;
 
+namespace {
 // A resolved relocation. The Sec and Offset fields are set if the relocation
 // was resolved to an offset within a section.
 template <class ELFT>
@@ -48,6 +49,7 @@ struct ResolvedReloc {
   InputSectionBase<ELFT> *Sec;
   typename ELFT::uint Offset;
 };
+} // end anonymous namespace
 
 template <class ELFT>
 static typename ELFT::uint getAddend(InputSectionBase<ELFT> &Sec,

Modified: lld/trunk/ELF/SymbolListFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolListFile.cpp?rev=277926&r1=277925&r2=277926&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolListFile.cpp (original)
+++ lld/trunk/ELF/SymbolListFile.cpp Sat Aug  6 08:52:37 2016
@@ -31,11 +31,13 @@ using namespace lld::elf;
 // Multiple groups can be defined in the same file, and they are merged
 // into a single group.
 
+namespace {
 class DynamicListParser final : public ScriptParserBase {
 public:
   DynamicListParser(StringRef S) : ScriptParserBase(S) {}
   void run();
 };
+} // end anonymous namespace
 
 void DynamicListParser::run() {
   while (!atEOF()) {
@@ -62,6 +64,7 @@ void elf::parseDynamicList(MemoryBufferR
 // No wildcards are supported, other than for the local entry. Symbol versioning
 // is also not supported.
 
+namespace {
 class VersionScriptParser final : public ScriptParserBase {
 public:
   VersionScriptParser(StringRef S) : ScriptParserBase(S) {}
@@ -74,6 +77,7 @@ private:
   void parseGlobal(StringRef VerStr);
   void parseLocal();
 };
+} // end anonymous namespace
 
 size_t elf::defineSymbolVersion(StringRef VerStr) {
   // Identifiers start at 2 because 0 and 1 are reserved

Modified: lld/trunk/lib/Core/Error.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/Error.cpp?rev=277926&r1=277925&r2=277926&view=diff
==============================================================================
--- lld/trunk/lib/Core/Error.cpp (original)
+++ lld/trunk/lib/Core/Error.cpp Sat Aug  6 08:52:37 2016
@@ -16,6 +16,7 @@
 
 using namespace lld;
 
+namespace {
 class _YamlReaderErrorCategory : public std::error_category {
 public:
   const char* name() const LLVM_NOEXCEPT override {
@@ -33,6 +34,7 @@ public:
                      "message defined.");
   }
 };
+} // end anonymous namespace
 
 const std::error_category &lld::YamlReaderCategory() {
   static _YamlReaderErrorCategory o;




More information about the llvm-commits mailing list