From 5fa471e2525ee435d545219225d11e11244210f5 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 4 Jun 2014 09:09:06 +0000 Subject: Fix a wrong comment. Previously FileArchive ctor comment said that only its subclasses can be instantiated, but the ctor is actually public and is instantiated by ArchiveReader. Remove the wrong comment and reorder the member functions so that public members appear before private ones. llvm-svn: 210175 --- lld/lib/ReaderWriter/FileArchive.cpp | 59 +++++++++++++++++------------------- 1 file changed, 28 insertions(+), 31 deletions(-) (limited to 'lld/lib/ReaderWriter/FileArchive.cpp') diff --git a/lld/lib/ReaderWriter/FileArchive.cpp b/lld/lib/ReaderWriter/FileArchive.cpp index e1685fb0f62..549d4ffcccb 100644 --- a/lld/lib/ReaderWriter/FileArchive.cpp +++ b/lld/lib/ReaderWriter/FileArchive.cpp @@ -35,6 +35,12 @@ namespace { /// \brief The FileArchive class represents an Archive Library file class FileArchive : public lld::ArchiveLibraryFile { public: + FileArchive(const Registry ®istry, Archive *archive, StringRef path, + bool isWholeArchive, bool logLoading) + : ArchiveLibraryFile(path), _registry(registry), + _archive(std::move(archive)), _isWholeArchive(isWholeArchive), + _logLoading(logLoading) {} + virtual ~FileArchive() {} /// \brief Check if any member of the archive contains an Atom with the @@ -97,6 +103,27 @@ public: return _absoluteAtoms; } + error_code buildTableOfContents() { + DEBUG_WITH_TYPE("FileArchive", llvm::dbgs() + << "Table of contents for archive '" + << _archive->getFileName() << "':\n"); + for (auto i = _archive->symbol_begin(), e = _archive->symbol_end(); + i != e; ++i) { + StringRef name; + Archive::child_iterator member; + if (error_code ec = i->getName(name)) + return ec; + if (error_code ec = i->getMember(member)) + return ec; + DEBUG_WITH_TYPE( + "FileArchive", + llvm::dbgs() << llvm::format("0x%08llX ", member->getBuffer().data()) + << "'" << name << "'\n"); + _symbolMemberMap[name] = member; + } + return error_code(); + } + /// Returns a set of all defined symbols in the archive. std::set getDefinedSymbols() const override { std::set ret; @@ -171,37 +198,7 @@ private: atom_collection_vector _absoluteAtoms; bool _isWholeArchive; bool _logLoading; - -public: - /// only subclasses of ArchiveLibraryFile can be instantiated - FileArchive(const Registry ®istry, Archive *archive, StringRef path, - bool isWholeArchive, bool logLoading) - : ArchiveLibraryFile(path), _registry(registry), - _archive(std::move(archive)), _isWholeArchive(isWholeArchive), - _logLoading(logLoading) {} - - error_code buildTableOfContents() { - DEBUG_WITH_TYPE("FileArchive", llvm::dbgs() - << "Table of contents for archive '" - << _archive->getFileName() << "':\n"); - for (auto i = _archive->symbol_begin(), e = _archive->symbol_end(); - i != e; ++i) { - StringRef name; - Archive::child_iterator member; - if (error_code ec = i->getName(name)) - return ec; - if (error_code ec = i->getMember(member)) - return ec; - DEBUG_WITH_TYPE( - "FileArchive", - llvm::dbgs() << llvm::format("0x%08llX ", member->getBuffer().data()) - << "'" << name << "'\n"); - _symbolMemberMap[name] = member; - } - return error_code(); - } - -}; // class FileArchive +}; class ArchiveReader : public Reader { public: -- cgit v1.2.3