From: Rui Ueyama Date: Tue, 7 Apr 2015 20:43:38 +0000 (+0000) Subject: Merge MutableFile with SimpleFile. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3c45cffd68cd9839d4737ea260ed2706ab304cc9;p=platform%2Fupstream%2Fllvm.git Merge MutableFile with SimpleFile. SimpleFile is the only derived class of MutableFile. This patch reduces the height of class hierarchy by removing MutableFile class. llvm-svn: 234354 --- diff --git a/lld/include/lld/Core/File.h b/lld/include/lld/Core/File.h index 25b177e..d0f9658 100644 --- a/lld/include/lld/Core/File.h +++ b/lld/include/lld/Core/File.h @@ -272,24 +272,6 @@ private: std::mutex _parseMutex; }; -/// \brief A mutable File. -class MutableFile : public File { -public: - /// \brief Add an atom to the file. Invalidates iterators for all returned - /// containters. - virtual void addAtom(const Atom&) = 0; - - typedef range::iterator> DefinedAtomRange; - virtual DefinedAtomRange definedAtoms() = 0; - - virtual void - removeDefinedAtomsIf(std::function pred) = 0; - -protected: - /// \brief only subclasses of MutableFile can be instantiated - MutableFile(StringRef p) : File(p, kindObject) {} -}; - /// An ErrorFile represents a file that doesn't exist. /// If you try to parse a file which doesn't exist, an instance of this /// class will be returned. That's parse method always returns an error. diff --git a/lld/include/lld/Core/Pass.h b/lld/include/lld/Core/Pass.h index 7a9d245..14170d8 100644 --- a/lld/include/lld/Core/Pass.h +++ b/lld/include/lld/Core/Pass.h @@ -17,7 +17,7 @@ #include namespace lld { -class MutableFile; +class SimpleFile; /// Once the core linking is done (which resolves references, coalesces atoms /// and produces a complete Atom graph), the linker runs a series of passes @@ -34,7 +34,7 @@ public: virtual ~Pass() { } /// Do the actual work of the Pass. - virtual void perform(std::unique_ptr &mergedFile) = 0; + virtual void perform(std::unique_ptr &mergedFile) = 0; protected: // Only subclassess can be instantiated. diff --git a/lld/include/lld/Core/PassManager.h b/lld/include/lld/Core/PassManager.h index 65fc4d8..290e527 100644 --- a/lld/include/lld/Core/PassManager.h +++ b/lld/include/lld/Core/PassManager.h @@ -16,7 +16,7 @@ #include namespace lld { -class MutableFile; +class SimpleFile; class Pass; /// \brief Owns and runs a collection of passes. @@ -31,7 +31,7 @@ public: _passes.push_back(std::move(pass)); } - std::error_code runOnFile(std::unique_ptr &file) { + std::error_code runOnFile(std::unique_ptr &file) { for (std::unique_ptr &pass : _passes) pass->perform(file); return std::error_code(); diff --git a/lld/include/lld/Core/Resolver.h b/lld/include/lld/Core/Resolver.h index e16c07b..05af7d9 100644 --- a/lld/include/lld/Core/Resolver.h +++ b/lld/include/lld/Core/Resolver.h @@ -54,7 +54,7 @@ public: /// @brief do work of merging and resolving and return list bool resolve(); - std::unique_ptr resultFile() { return std::move(_result); } + std::unique_ptr resultFile() { return std::move(_result); } private: typedef std::function UndefCallback; diff --git a/lld/include/lld/Core/Simple.h b/lld/include/lld/Core/Simple.h index 6aa12ae..2a5a4b1 100644 --- a/lld/include/lld/Core/Simple.h +++ b/lld/include/lld/Core/Simple.h @@ -26,11 +26,11 @@ namespace lld { -class SimpleFile : public MutableFile { +class SimpleFile : public File { public: - SimpleFile(StringRef path) : MutableFile(path) {} + SimpleFile(StringRef path) : File(path, kindObject) {} - void addAtom(const Atom &atom) override { + void addAtom(const Atom &atom) { if (auto *defAtom = dyn_cast(&atom)) { _definedAtoms._atoms.push_back(defAtom); } else if (auto *undefAtom = dyn_cast(&atom)) { @@ -44,8 +44,7 @@ public: } } - void - removeDefinedAtomsIf(std::function pred) override { + void removeDefinedAtomsIf(std::function pred) { auto &atoms = _definedAtoms._atoms; auto newEnd = std::remove_if(atoms.begin(), atoms.end(), pred); atoms.erase(newEnd, atoms.end()); @@ -67,9 +66,8 @@ public: return _absoluteAtoms; } - DefinedAtomRange definedAtoms() override { - return make_range(_definedAtoms._atoms); - } + typedef range::iterator> DefinedAtomRange; + DefinedAtomRange definedAtoms() { return make_range(_definedAtoms._atoms); } private: atom_collection_vector _definedAtoms; diff --git a/lld/lib/Driver/Driver.cpp b/lld/lib/Driver/Driver.cpp index ba6696b..233ecd4 100644 --- a/lld/lib/Driver/Driver.cpp +++ b/lld/lib/Driver/Driver.cpp @@ -108,7 +108,7 @@ bool Driver::link(LinkingContext &ctx, raw_ostream &diagnostics) { ctx.getTaskGroup().sync(); return false; } - std::unique_ptr merged = resolver.resultFile(); + std::unique_ptr merged = resolver.resultFile(); resolveTask.end(); // Run passes on linked atoms. diff --git a/lld/lib/ReaderWriter/CoreLinkingContext.cpp b/lld/lib/ReaderWriter/CoreLinkingContext.cpp index 316f858..1c40133 100644 --- a/lld/lib/ReaderWriter/CoreLinkingContext.cpp +++ b/lld/lib/ReaderWriter/CoreLinkingContext.cpp @@ -144,8 +144,8 @@ private: class OrderPass : public Pass { public: /// Sorts atoms by position - void perform(std::unique_ptr &file) override { - MutableFile::DefinedAtomRange defined = file->definedAtoms(); + void perform(std::unique_ptr &file) override { + SimpleFile::DefinedAtomRange defined = file->definedAtoms(); std::sort(defined.begin(), defined.end(), DefinedAtom::compareByPosition); } }; diff --git a/lld/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp b/lld/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp index 2f0735f..ba74bd5 100644 --- a/lld/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp +++ b/lld/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp @@ -254,7 +254,7 @@ public: /// /// After all references are handled, the atoms created during that are all /// added to mf. - void perform(std::unique_ptr &mf) override { + void perform(std::unique_ptr &mf) override { ScopedTask task(getDefaultDomain(), "AArch64 GOT/PLT Pass"); DEBUG_WITH_TYPE( "AArch64", llvm::dbgs() << "Undefined Atoms" diff --git a/lld/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp b/lld/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp index 22bcb4d..9889f1f 100644 --- a/lld/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp +++ b/lld/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp @@ -482,7 +482,7 @@ public: /// /// After all references are handled, the atoms created during that are all /// added to mf. - void perform(std::unique_ptr &mf) override { + void perform(std::unique_ptr &mf) override { ScopedTask task(getDefaultDomain(), "ARM GOT/PLT Pass"); DEBUG_WITH_TYPE( "ARM", llvm::dbgs() << "Undefined Atoms" << "\n"; diff --git a/lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp b/lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp index 85a2d4f..b69bc94 100644 --- a/lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp +++ b/lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp @@ -171,7 +171,7 @@ public: /// /// After all references are handled, the atoms created during that are all /// added to mf. - void perform(std::unique_ptr &mf) override { + void perform(std::unique_ptr &mf) override { // Process all references. for (const auto &atom : mf->defined()) for (const auto &ref : *atom) diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp index 8bf8025..4383ad4 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "MipsCtorsOrderPass.h" +#include "lld/Core/Simple.h" #include #include @@ -48,7 +49,7 @@ static int32_t getSectionPriority(StringRef path, StringRef sectionName) { return priority; } -void MipsCtorsOrderPass::perform(std::unique_ptr &f) { +void MipsCtorsOrderPass::perform(std::unique_ptr &f) { auto definedAtoms = f->definedAtoms(); auto last = std::stable_partition(definedAtoms.begin(), definedAtoms.end(), diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.h b/lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.h index eeb1a19..733e2d4 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.h @@ -17,7 +17,7 @@ namespace elf { /// \brief This pass sorts atoms in .{ctors,dtors}. sections. class MipsCtorsOrderPass : public Pass { public: - void perform(std::unique_ptr &mergedFile) override; + void perform(std::unique_ptr &mergedFile) override; }; } } diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp index 1788e63..203957a 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp @@ -295,7 +295,7 @@ template class RelocationPass : public Pass { public: RelocationPass(MipsLinkingContext &ctx); - void perform(std::unique_ptr &mf) override; + void perform(std::unique_ptr &mf) override; private: /// \brief Reference to the linking context. @@ -418,7 +418,7 @@ RelocationPass::RelocationPass(MipsLinkingContext &ctx) } template -void RelocationPass::perform(std::unique_ptr &mf) { +void RelocationPass::perform(std::unique_ptr &mf) { for (const auto &atom : mf->defined()) for (const auto &ref : *atom) collectReferenceInfo(*cast>(atom), diff --git a/lld/lib/ReaderWriter/ELF/OrderPass.h b/lld/lib/ReaderWriter/ELF/OrderPass.h index d126b83..74bddc8 100644 --- a/lld/lib/ReaderWriter/ELF/OrderPass.h +++ b/lld/lib/ReaderWriter/ELF/OrderPass.h @@ -19,7 +19,7 @@ namespace elf { /// \brief This pass sorts atoms by file and atom ordinals. class OrderPass : public Pass { public: - void perform(std::unique_ptr &file) override { + void perform(std::unique_ptr &file) override { parallel_sort(file->definedAtoms().begin(), file->definedAtoms().end(), DefinedAtom::compareByPosition); } diff --git a/lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp b/lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp index 0395c52..64d46f9 100644 --- a/lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp +++ b/lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp @@ -253,7 +253,7 @@ public: /// /// After all references are handled, the atoms created during that are all /// added to mf. - void perform(std::unique_ptr &mf) override { + void perform(std::unique_ptr &mf) override { ScopedTask task(getDefaultDomain(), "X86-64 GOT/PLT Pass"); // Process all references. for (const auto &atom : mf->defined()) diff --git a/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp b/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp index e2037c3..3bef510 100644 --- a/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp +++ b/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp @@ -277,7 +277,7 @@ public: _isBig(MachOLinkingContext::isBigEndian(_context.arch())) {} private: - void perform(std::unique_ptr &mergedFile) override { + void perform(std::unique_ptr &mergedFile) override { DEBUG(llvm::dbgs() << "MachO Compact Unwind pass\n"); std::map unwindLocs; @@ -351,7 +351,7 @@ private: } void collectCompactUnwindEntries( - std::unique_ptr &mergedFile, + std::unique_ptr &mergedFile, std::map &unwindLocs, std::vector &personalities, uint32_t &numLSDAs) { DEBUG(llvm::dbgs() << " Collecting __compact_unwind entries\n"); @@ -422,7 +422,7 @@ private: } void - collectDwarfFrameEntries(std::unique_ptr &mergedFile, + collectDwarfFrameEntries(std::unique_ptr &mergedFile, std::map &dwarfFrames) { for (const DefinedAtom *ehFrameAtom : mergedFile->defined()) { if (ehFrameAtom->contentType() != DefinedAtom::typeCFI) @@ -442,7 +442,7 @@ private: /// + A synthesised reference to __eh_frame if there's no __compact_unwind /// or too many personality functions to be accommodated. std::vector createUnwindInfoEntries( - const std::unique_ptr &mergedFile, + const std::unique_ptr &mergedFile, const std::map &unwindLocs, const std::vector &personalities, const std::map &dwarfFrames) { diff --git a/lld/lib/ReaderWriter/MachO/GOTPass.cpp b/lld/lib/ReaderWriter/MachO/GOTPass.cpp index 7dc7f0b..5e885c2 100644 --- a/lld/lib/ReaderWriter/MachO/GOTPass.cpp +++ b/lld/lib/ReaderWriter/MachO/GOTPass.cpp @@ -96,8 +96,7 @@ public: _file("") { } private: - - void perform(std::unique_ptr &mergedFile) override { + void perform(std::unique_ptr &mergedFile) override { // Scan all references in all atoms. for (const DefinedAtom *atom : mergedFile->defined()) { for (const Reference *ref : *atom) { diff --git a/lld/lib/ReaderWriter/MachO/LayoutPass.cpp b/lld/lib/ReaderWriter/MachO/LayoutPass.cpp index 2d096e4..de3d5c2 100644 --- a/lld/lib/ReaderWriter/MachO/LayoutPass.cpp +++ b/lld/lib/ReaderWriter/MachO/LayoutPass.cpp @@ -133,7 +133,7 @@ static void checkReachabilityFromRoot(AtomToAtomT &followOnRoots, } } -static void printDefinedAtoms(const MutableFile::DefinedAtomRange &atomRange) { +static void printDefinedAtoms(const SimpleFile::DefinedAtomRange &atomRange) { for (const DefinedAtom *atom : atomRange) { llvm::dbgs() << " file=" << atom->file().path() << ", name=" << atom->name() @@ -146,7 +146,7 @@ static void printDefinedAtoms(const MutableFile::DefinedAtomRange &atomRange) { /// Verify that the followon chain is sane. Should not be called in /// release binary. -void LayoutPass::checkFollowonChain(MutableFile::DefinedAtomRange &range) { +void LayoutPass::checkFollowonChain(SimpleFile::DefinedAtomRange &range) { ScopedTask task(getDefaultDomain(), "LayoutPass::checkFollowonChain"); // Verify that there's no cycle in follow-on chain. @@ -329,7 +329,7 @@ void LayoutPass::setChainRoot(const DefinedAtom *targetAtom, /// d) If the targetAtom is part of a different chain and the root of the /// targetAtom until the targetAtom has all atoms of size 0, then chain the /// targetAtoms and its tree to the current chain -void LayoutPass::buildFollowOnTable(MutableFile::DefinedAtomRange &range) { +void LayoutPass::buildFollowOnTable(SimpleFile::DefinedAtomRange &range) { ScopedTask task(getDefaultDomain(), "LayoutPass::buildFollowOnTable"); // Set the initial size of the followon and the followonNext hash to the // number of atoms that we have. @@ -397,7 +397,7 @@ void LayoutPass::buildFollowOnTable(MutableFile::DefinedAtomRange &range) { /// assigning ordinals to each atom, if the atoms have their ordinals /// already assigned skip the atom and move to the next. This is the /// main map thats used to sort the atoms while comparing two atoms together -void LayoutPass::buildOrdinalOverrideMap(MutableFile::DefinedAtomRange &range) { +void LayoutPass::buildOrdinalOverrideMap(SimpleFile::DefinedAtomRange &range) { ScopedTask task(getDefaultDomain(), "LayoutPass::buildOrdinalOverrideMap"); uint64_t index = 0; for (const DefinedAtom *ai : range) { @@ -417,7 +417,7 @@ void LayoutPass::buildOrdinalOverrideMap(MutableFile::DefinedAtomRange &range) { } std::vector -LayoutPass::decorate(MutableFile::DefinedAtomRange &atomRange) const { +LayoutPass::decorate(SimpleFile::DefinedAtomRange &atomRange) const { std::vector ret; for (const DefinedAtom *atom : atomRange) { auto ri = _followOnRoots.find(atom); @@ -429,7 +429,7 @@ LayoutPass::decorate(MutableFile::DefinedAtomRange &atomRange) const { return ret; } -void LayoutPass::undecorate(MutableFile::DefinedAtomRange &atomRange, +void LayoutPass::undecorate(SimpleFile::DefinedAtomRange &atomRange, std::vector &keys) const { size_t i = 0; for (SortKey &k : keys) @@ -437,10 +437,10 @@ void LayoutPass::undecorate(MutableFile::DefinedAtomRange &atomRange, } /// Perform the actual pass -void LayoutPass::perform(std::unique_ptr &mergedFile) { +void LayoutPass::perform(std::unique_ptr &mergedFile) { // sort the atoms ScopedTask task(getDefaultDomain(), "LayoutPass"); - MutableFile::DefinedAtomRange atomRange = mergedFile->definedAtoms(); + SimpleFile::DefinedAtomRange atomRange = mergedFile->definedAtoms(); // Build follow on tables buildFollowOnTable(atomRange); diff --git a/lld/lib/ReaderWriter/MachO/LayoutPass.h b/lld/lib/ReaderWriter/MachO/LayoutPass.h index 186f29be..2b31e0e 100644 --- a/lld/lib/ReaderWriter/MachO/LayoutPass.h +++ b/lld/lib/ReaderWriter/MachO/LayoutPass.h @@ -13,6 +13,7 @@ #include "lld/Core/File.h" #include "lld/Core/Pass.h" #include "lld/Core/Reader.h" +#include "lld/Core/Simple.h" #include "llvm/ADT/DenseMap.h" #include #include @@ -20,7 +21,7 @@ namespace lld { class DefinedAtom; -class MutableFile; +class SimpleFile; namespace mach_o { @@ -45,17 +46,17 @@ public: LayoutPass(const Registry ®istry, SortOverride sorter); /// Sorts atoms in mergedFile by content type then by command line order. - void perform(std::unique_ptr &mergedFile) override; + void perform(std::unique_ptr &mergedFile) override; virtual ~LayoutPass() {} private: // Build the followOn atoms chain as specified by the kindLayoutAfter // reference type - void buildFollowOnTable(MutableFile::DefinedAtomRange &range); + void buildFollowOnTable(SimpleFile::DefinedAtomRange &range); // Build a map of Atoms to ordinals for sorting the atoms - void buildOrdinalOverrideMap(MutableFile::DefinedAtomRange &range); + void buildOrdinalOverrideMap(SimpleFile::DefinedAtomRange &range); const Registry &_registry; SortOverride _customSorter; @@ -83,12 +84,12 @@ private: void setChainRoot(const DefinedAtom *targetAtom, const DefinedAtom *root); - std::vector decorate(MutableFile::DefinedAtomRange &atomRange) const; - void undecorate(MutableFile::DefinedAtomRange &atomRange, + std::vector decorate(SimpleFile::DefinedAtomRange &atomRange) const; + void undecorate(SimpleFile::DefinedAtomRange &atomRange, std::vector &keys) const; // Check if the follow-on graph is a correct structure. For debugging only. - void checkFollowonChain(MutableFile::DefinedAtomRange &range); + void checkFollowonChain(SimpleFile::DefinedAtomRange &range); }; } // namespace mach_o diff --git a/lld/lib/ReaderWriter/MachO/ShimPass.cpp b/lld/lib/ReaderWriter/MachO/ShimPass.cpp index a8c69f8c..8d53c23 100644 --- a/lld/lib/ReaderWriter/MachO/ShimPass.cpp +++ b/lld/lib/ReaderWriter/MachO/ShimPass.cpp @@ -47,8 +47,7 @@ public: , _file("") { } - - void perform(std::unique_ptr &mergedFile) override { + void perform(std::unique_ptr &mergedFile) override { // Scan all references in all atoms. for (const DefinedAtom *atom : mergedFile->defined()) { for (const Reference *ref : *atom) { diff --git a/lld/lib/ReaderWriter/MachO/StubsPass.cpp b/lld/lib/ReaderWriter/MachO/StubsPass.cpp index aac3a60c..5c4bb2c 100644 --- a/lld/lib/ReaderWriter/MachO/StubsPass.cpp +++ b/lld/lib/ReaderWriter/MachO/StubsPass.cpp @@ -209,8 +209,7 @@ public: : _context(context), _archHandler(_context.archHandler()), _stubInfo(_archHandler.stubInfo()), _file("") { } - - void perform(std::unique_ptr &mergedFile) override { + void perform(std::unique_ptr &mergedFile) override { // Skip this pass if output format uses text relocations instead of stubs. if (!this->noTextRelocs()) return; diff --git a/lld/lib/ReaderWriter/PECOFF/EdataPass.cpp b/lld/lib/ReaderWriter/PECOFF/EdataPass.cpp index ad79f17..2c91ffb 100644 --- a/lld/lib/ReaderWriter/PECOFF/EdataPass.cpp +++ b/lld/lib/ReaderWriter/PECOFF/EdataPass.cpp @@ -78,7 +78,7 @@ static void assignOrdinals(PECOFFLinkingContext &ctx) { desc.ordinal = nextOrdinal++; } -static bool getExportedAtoms(PECOFFLinkingContext &ctx, MutableFile *file, +static bool getExportedAtoms(PECOFFLinkingContext &ctx, SimpleFile *file, std::vector &ret) { std::map definedAtoms; for (const DefinedAtom *atom : file->defined()) @@ -135,7 +135,7 @@ EdataPass::createAddressTable(const std::vector &entries, edata::EdataAtom * EdataPass::createNamePointerTable(const PECOFFLinkingContext &ctx, const std::vector &entries, - MutableFile *file) { + SimpleFile *file) { EdataAtom *table = new (_alloc) EdataAtom(_file, sizeof(uint32_t) * entries.size()); @@ -175,7 +175,7 @@ EdataPass::createOrdinalTable(const std::vector &entries, return ret; } -void EdataPass::perform(std::unique_ptr &file) { +void EdataPass::perform(std::unique_ptr &file) { dedupExports(_ctx); assignOrdinals(_ctx); diff --git a/lld/lib/ReaderWriter/PECOFF/EdataPass.h b/lld/lib/ReaderWriter/PECOFF/EdataPass.h index 442be3c..0132c9ca 100644 --- a/lld/lib/ReaderWriter/PECOFF/EdataPass.h +++ b/lld/lib/ReaderWriter/PECOFF/EdataPass.h @@ -66,7 +66,7 @@ public: EdataPass(PECOFFLinkingContext &ctx) : _ctx(ctx), _file(ctx), _is64(ctx.is64Bit()), _stringOrdinal(1024) {} - void perform(std::unique_ptr &file) override; + void perform(std::unique_ptr &file) override; private: edata::EdataAtom * @@ -80,7 +80,7 @@ private: edata::EdataAtom * createNamePointerTable(const PECOFFLinkingContext &ctx, const std::vector &entries, - MutableFile *file); + SimpleFile *file); edata::EdataAtom * createOrdinalTable(const std::vector &entries, diff --git a/lld/lib/ReaderWriter/PECOFF/IdataPass.cpp b/lld/lib/ReaderWriter/PECOFF/IdataPass.cpp index 8eed472..e19024a 100644 --- a/lld/lib/ReaderWriter/PECOFF/IdataPass.cpp +++ b/lld/lib/ReaderWriter/PECOFF/IdataPass.cpp @@ -143,8 +143,8 @@ std::vector DelayImportDirectoryAtom::createContent() { // Find "___delayLoadHelper2@8" (or "__delayLoadHelper2" on x64). // This is not efficient but should be OK for now. -static const Atom * -findDelayLoadHelper(MutableFile &file, const PECOFFLinkingContext &ctx) { +static const Atom *findDelayLoadHelper(SimpleFile &file, + const PECOFFLinkingContext &ctx) { StringRef sym = ctx.getDelayLoadHelperName(); for (const DefinedAtom *atom : file.defined()) if (atom->name() == sym) @@ -287,7 +287,7 @@ DelayLoaderAtom::createContent(MachineTypes machine) const { } // namespace idata -void IdataPass::perform(std::unique_ptr &file) { +void IdataPass::perform(std::unique_ptr &file) { if (file->sharedLibrary().empty()) return; @@ -324,8 +324,8 @@ void IdataPass::perform(std::unique_ptr &file) { replaceSharedLibraryAtoms(*file); } -std::map > -IdataPass::groupByLoadName(MutableFile &file) { +std::map> +IdataPass::groupByLoadName(SimpleFile &file) { std::map uniqueAtoms; for (const SharedLibraryAtom *atom : file.sharedLibrary()) uniqueAtoms[atom->name()] = @@ -340,7 +340,7 @@ IdataPass::groupByLoadName(MutableFile &file) { } /// Transforms a reference to a COFFSharedLibraryAtom to a real reference. -void IdataPass::replaceSharedLibraryAtoms(MutableFile &file) { +void IdataPass::replaceSharedLibraryAtoms(SimpleFile &file) { for (const DefinedAtom *atom : file.defined()) { for (const Reference *ref : *atom) { const Atom *target = ref->target(); diff --git a/lld/lib/ReaderWriter/PECOFF/IdataPass.h b/lld/lib/ReaderWriter/PECOFF/IdataPass.h index 7374c82..7cf4155 100644 --- a/lld/lib/ReaderWriter/PECOFF/IdataPass.h +++ b/lld/lib/ReaderWriter/PECOFF/IdataPass.h @@ -40,9 +40,9 @@ class ImportTableEntryAtom; // A state object of this pass. struct IdataContext { - IdataContext(MutableFile &f, VirtualFile &g, const PECOFFLinkingContext &c) + IdataContext(SimpleFile &f, VirtualFile &g, const PECOFFLinkingContext &c) : file(f), dummyFile(g), ctx(c) {} - MutableFile &file; + SimpleFile &file; VirtualFile &dummyFile; const PECOFFLinkingContext &ctx; }; @@ -195,13 +195,13 @@ class IdataPass : public lld::Pass { public: IdataPass(const PECOFFLinkingContext &ctx) : _dummyFile(ctx), _ctx(ctx) {} - void perform(std::unique_ptr &file) override; + void perform(std::unique_ptr &file) override; private: std::map> - groupByLoadName(MutableFile &file); + groupByLoadName(SimpleFile &file); - void replaceSharedLibraryAtoms(MutableFile &file); + void replaceSharedLibraryAtoms(SimpleFile &file); // A dummy file with which all the atoms created in the pass will be // associated. Atoms need to be associated to an input file even if it's not diff --git a/lld/lib/ReaderWriter/PECOFF/InferSubsystemPass.h b/lld/lib/ReaderWriter/PECOFF/InferSubsystemPass.h index cbf863e..f17c26e 100644 --- a/lld/lib/ReaderWriter/PECOFF/InferSubsystemPass.h +++ b/lld/lib/ReaderWriter/PECOFF/InferSubsystemPass.h @@ -22,7 +22,7 @@ class InferSubsystemPass : public lld::Pass { public: InferSubsystemPass(PECOFFLinkingContext &ctx) : _ctx(ctx) {} - void perform(std::unique_ptr &file) override { + void perform(std::unique_ptr &file) override { if (_ctx.getSubsystem() != WindowsSubsystem::IMAGE_SUBSYSTEM_UNKNOWN) return; diff --git a/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.cpp b/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.cpp index be2f5627..f2a9609 100644 --- a/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.cpp +++ b/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.cpp @@ -49,7 +49,7 @@ LoadConfigAtom::LoadConfigAtom(VirtualFile &file, const DefinedAtom *sxdata, } // namespace loadcfg -void LoadConfigPass::perform(std::unique_ptr &file) { +void LoadConfigPass::perform(std::unique_ptr &file) { if (_ctx.noSEH()) return; diff --git a/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.h b/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.h index 9f4a25f..c8ab594 100644 --- a/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.h +++ b/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.h @@ -49,7 +49,7 @@ class LoadConfigPass : public lld::Pass { public: LoadConfigPass(PECOFFLinkingContext &ctx) : _ctx(ctx), _file(ctx) {} - void perform(std::unique_ptr &file) override; + void perform(std::unique_ptr &file) override; private: PECOFFLinkingContext &_ctx; diff --git a/lld/lib/ReaderWriter/PECOFF/OrderPass.h b/lld/lib/ReaderWriter/PECOFF/OrderPass.h index 73133ff..9ffe179 100644 --- a/lld/lib/ReaderWriter/PECOFF/OrderPass.h +++ b/lld/lib/ReaderWriter/PECOFF/OrderPass.h @@ -55,8 +55,8 @@ static bool compare(const DefinedAtom *lhs, const DefinedAtom *rhs) { class OrderPass : public lld::Pass { public: - void perform(std::unique_ptr &file) override { - MutableFile::DefinedAtomRange defined = file->definedAtoms(); + void perform(std::unique_ptr &file) override { + SimpleFile::DefinedAtomRange defined = file->definedAtoms(); parallel_sort(defined.begin(), defined.end(), compare); } }; diff --git a/lld/lib/ReaderWriter/PECOFF/PDBPass.h b/lld/lib/ReaderWriter/PECOFF/PDBPass.h index 0efa054..2fbe60e 100644 --- a/lld/lib/ReaderWriter/PECOFF/PDBPass.h +++ b/lld/lib/ReaderWriter/PECOFF/PDBPass.h @@ -21,7 +21,7 @@ class PDBPass : public lld::Pass { public: PDBPass(PECOFFLinkingContext &ctx) : _ctx(ctx) {} - void perform(std::unique_ptr &file) override { + void perform(std::unique_ptr &file) override { if (_ctx.getDebug()) touch(_ctx.getPDBFilePath()); }