diff options
author | Rui Ueyama <ruiu@google.com> | 2014-06-04 09:09:06 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2014-06-04 09:09:06 +0000 |
commit | 5fa471e2525ee435d545219225d11e11244210f5 (patch) | |
tree | 80283adc185af7eea5609ff252d6ae49f0f2f913 /lld/lib/ReaderWriter/FileArchive.cpp | |
parent | e5d36a910e5142f4b88c02cf2895a946b29530b1 (diff) | |
download | bcm5719-llvm-5fa471e2525ee435d545219225d11e11244210f5.tar.gz bcm5719-llvm-5fa471e2525ee435d545219225d11e11244210f5.zip |
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
Diffstat (limited to 'lld/lib/ReaderWriter/FileArchive.cpp')
-rw-r--r-- | lld/lib/ReaderWriter/FileArchive.cpp | 59 |
1 files changed, 28 insertions, 31 deletions
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<StringRef> getDefinedSymbols() const override { std::set<StringRef> ret; @@ -171,37 +198,7 @@ private: atom_collection_vector<AbsoluteAtom> _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: |