diff options
| -rw-r--r-- | lld/include/lld/Core/Simple.h | 26 | ||||
| -rw-r--r-- | lld/lib/ReaderWriter/MachO/Atoms.h | 17 | ||||
| -rw-r--r-- | lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp | 29 |
3 files changed, 53 insertions, 19 deletions
diff --git a/lld/include/lld/Core/Simple.h b/lld/include/lld/Core/Simple.h index f010387d5bd..cfef02e049d 100644 --- a/lld/include/lld/Core/Simple.h +++ b/lld/include/lld/Core/Simple.h @@ -15,14 +15,23 @@ #ifndef LLD_CORE_SIMPLE_H #define LLD_CORE_SIMPLE_H +#include "lld/Core/AbsoluteAtom.h" +#include "lld/Core/Atom.h" #include "lld/Core/DefinedAtom.h" #include "lld/Core/File.h" -#include "lld/Core/LinkingContext.h" #include "lld/Core/Reference.h" +#include "lld/Core/SharedLibraryAtom.h" #include "lld/Core/UndefinedAtom.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" #include "llvm/ADT/ilist.h" -#include "llvm/ADT/ilist_node.h" -#include <atomic> +#include "llvm/Support/Allocator.h" +#include "llvm/Support/Casting.h" +#include "llvm/Support/ErrorHandling.h" +#include <algorithm> +#include <cassert> +#include <cstdint> +#include <functional> namespace lld { @@ -142,12 +151,13 @@ private: SimpleReference *_prev; }; -} +} // end namespace lld // ilist will lazily create a sentinal (so end() can return a node past the // end of the list). We need this trait so that the sentinal is allocated // via the BumpPtrAllocator. namespace llvm { + template<> struct ilist_sentinel_traits<lld::SimpleReference> { @@ -183,7 +193,8 @@ struct ilist_sentinel_traits<lld::SimpleReference> { private: mutable llvm::BumpPtrAllocator *_allocator; }; -} + +} // end namespace llvm namespace lld { @@ -194,7 +205,7 @@ public: _references.setAllocator(&f.allocator()); } - ~SimpleDefinedAtom() { + ~SimpleDefinedAtom() override { _references.clearAndLeakNodesUnsafely(); } @@ -278,6 +289,7 @@ public: _references.push_back(node); } } + void setOrdinal(uint64_t ord) { _ordinal = ord; } private: @@ -312,4 +324,4 @@ private: } // end namespace lld -#endif +#endif // LLD_CORE_SIMPLE_H diff --git a/lld/lib/ReaderWriter/MachO/Atoms.h b/lld/lib/ReaderWriter/MachO/Atoms.h index c3117d4ac89..573efca9f6f 100644 --- a/lld/lib/ReaderWriter/MachO/Atoms.h +++ b/lld/lib/ReaderWriter/MachO/Atoms.h @@ -1,4 +1,4 @@ -//===- lib/ReaderWriter/MachO/Atoms.h -------------------------------------===// +//===- lib/ReaderWriter/MachO/Atoms.h ---------------------------*- C++ -*-===// // // The LLVM Linker // @@ -10,10 +10,21 @@ #ifndef LLD_READER_WRITER_MACHO_ATOMS_H #define LLD_READER_WRITER_MACHO_ATOMS_H +#include "lld/Core/Atom.h" +#include "lld/Core/DefinedAtom.h" +#include "lld/Core/SharedLibraryAtom.h" #include "lld/Core/Simple.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/StringRef.h" +#include <cstdint> +#include <string> namespace lld { + +class File; + namespace mach_o { + class MachODefinedAtom : public SimpleDefinedAtom { public: MachODefinedAtom(const File &f, const StringRef name, Scope scope, @@ -164,7 +175,7 @@ private: StringRef _dylibInstallName; }; -} // namespace mach_o -} // namespace lld +} // end namespace mach_o +} // end namespace lld #endif // LLD_READER_WRITER_MACHO_ATOMS_H diff --git a/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp b/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp index ddbf101c5af..ee2a9ec1088 100644 --- a/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp +++ b/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp @@ -7,31 +7,41 @@ // //===----------------------------------------------------------------------===// +#include "lld/Core/AbsoluteAtom.h" #include "lld/Core/ArchiveLibraryFile.h" +#include "lld/Core/Atom.h" #include "lld/Core/DefinedAtom.h" #include "lld/Core/Error.h" #include "lld/Core/File.h" -#include "lld/Core/LLVM.h" +#include "lld/Core/LinkingContext.h" #include "lld/Core/Reader.h" #include "lld/Core/Reference.h" +#include "lld/Core/SharedLibraryAtom.h" #include "lld/Core/Simple.h" +#include "lld/Core/UndefinedAtom.h" #include "lld/Core/Writer.h" #include "lld/ReaderWriter/YamlContext.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" +#include "llvm/Support/Allocator.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/Errc.h" -#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/Error.h" +#include "llvm/Support/ErrorOr.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/Format.h" #include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/Path.h" #include "llvm/Support/YAMLTraits.h" #include "llvm/Support/raw_ostream.h" +#include <cassert> +#include <cstdint> +#include <cstring> #include <memory> #include <string> #include <system_error> +#include <vector> using llvm::yaml::MappingTraits; using llvm::yaml::ScalarEnumerationTraits; @@ -233,7 +243,7 @@ struct RefKind { Reference::KindValue value; }; -} // anonymous namespace +} // end anonymous namespace LLVM_YAML_IS_SEQUENCE_VECTOR(ArchMember) LLVM_YAML_IS_SEQUENCE_VECTOR(const lld::Reference *) @@ -838,7 +848,9 @@ template <> struct MappingTraits<const lld::DefinedAtom *> { << ", " << _name.size() << ")\n"); return this; } + void bind(const RefNameResolver &); + // Extract current File object from YAML I/O parsing context const lld::File &fileFromContext(IO &io) { YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext()); @@ -1044,7 +1056,6 @@ template <> struct MappingTraits<lld::UndefinedAtom *> { // YAML conversion for const lld::SharedLibraryAtom* template <> struct MappingTraits<const lld::SharedLibraryAtom *> { - class NormalizedAtom : public lld::SharedLibraryAtom { public: NormalizedAtom(IO &io) @@ -1199,8 +1210,8 @@ template <> struct MappingTraits<lld::AbsoluteAtom *> { } }; -} // namespace llvm -} // namespace yaml +} // end namespace llvm +} // end namespace yaml RefNameResolver::RefNameResolver(const lld::File *file, IO &io) : _io(io) { typedef MappingTraits<const lld::DefinedAtom *>::NormalizedAtom @@ -1371,7 +1382,7 @@ private: const Registry &_registry; }; -} // anonymous namespace +} // end anonymous namespace void Registry::addSupportYamlFiles() { add(std::unique_ptr<Reader>(new YAMLReader(*this))); |

