Index: lld/trunk/include/lld/Core/Simple.h =================================================================== --- lld/trunk/include/lld/Core/Simple.h +++ lld/trunk/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 +#include "llvm/Support/Allocator.h" +#include "llvm/Support/Casting.h" +#include "llvm/Support/ErrorHandling.h" +#include +#include +#include +#include namespace lld { @@ -142,12 +151,13 @@ 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 { @@ -183,7 +193,8 @@ private: mutable llvm::BumpPtrAllocator *_allocator; }; -} + +} // end namespace llvm namespace lld { @@ -194,7 +205,7 @@ _references.setAllocator(&f.allocator()); } - ~SimpleDefinedAtom() { + ~SimpleDefinedAtom() override { _references.clearAndLeakNodesUnsafely(); } @@ -278,6 +289,7 @@ _references.push_back(node); } } + void setOrdinal(uint64_t ord) { _ordinal = ord; } private: @@ -312,4 +324,4 @@ } // end namespace lld -#endif +#endif // LLD_CORE_SIMPLE_H Index: lld/trunk/lib/ReaderWriter/MachO/Atoms.h =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/Atoms.h +++ lld/trunk/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 +#include 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 @@ StringRef _dylibInstallName; }; -} // namespace mach_o -} // namespace lld +} // end namespace mach_o +} // end namespace lld #endif // LLD_READER_WRITER_MACHO_ATOMS_H Index: lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp +++ lld/trunk/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 +#include +#include #include #include #include +#include using llvm::yaml::MappingTraits; using llvm::yaml::ScalarEnumerationTraits; @@ -233,7 +243,7 @@ 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 @@ << ", " << _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(io.getContext()); @@ -1044,7 +1056,6 @@ // YAML conversion for const lld::SharedLibraryAtom* template <> struct MappingTraits { - class NormalizedAtom : public lld::SharedLibraryAtom { public: NormalizedAtom(IO &io) @@ -1199,8 +1210,8 @@ } }; -} // namespace llvm -} // namespace yaml +} // end namespace llvm +} // end namespace yaml RefNameResolver::RefNameResolver(const lld::File *file, IO &io) : _io(io) { typedef MappingTraits::NormalizedAtom @@ -1371,7 +1382,7 @@ const Registry &_registry; }; -} // anonymous namespace +} // end anonymous namespace void Registry::addSupportYamlFiles() { add(std::unique_ptr(new YAMLReader(*this)));