Unpollute the global namespace. lld edition.

llvm-svn: 277926
This commit is contained in:
Benjamin Kramer 2016-08-06 13:52:37 +00:00
parent ef10e922d8
commit df8f196f9a
4 changed files with 9 additions and 1 deletions

View File

@ -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));

View File

@ -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,

View File

@ -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(MemoryBufferRef MB) {
// 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

View File

@ -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;