From: Rui Ueyama Date: Wed, 4 Jun 2014 09:09:06 +0000 (+0000) Subject: Fix a wrong comment. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5fa471e2525ee435d545219225d11e11244210f5;p=platform%2Fupstream%2Fllvm.git 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 --- diff --git a/lld/lib/ReaderWriter/FileArchive.cpp b/lld/lib/ReaderWriter/FileArchive.cpp index e1685fb..549d4ff 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: