Fix a wrong comment.
authorRui Ueyama <ruiu@google.com>
Wed, 4 Jun 2014 09:09:06 +0000 (09:09 +0000)
committerRui Ueyama <ruiu@google.com>
Wed, 4 Jun 2014 09:09:06 +0000 (09:09 +0000)
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

index e1685fb..549d4ff 100644 (file)
@@ -35,6 +35,12 @@ namespace {
 /// \brief The FileArchive class represents an Archive Library file
 class FileArchive : public lld::ArchiveLibraryFile {
 public:
+  FileArchive(const Registry &registry, 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 &registry, 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: