[lld] r210175 - Fix a wrong comment.

Rui Ueyama ruiu at google.com
Wed Jun 4 02:09:07 PDT 2014


Author: ruiu
Date: Wed Jun  4 04:09:06 2014
New Revision: 210175

URL: http://llvm.org/viewvc/llvm-project?rev=210175&view=rev
Log:
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.

Modified:
    lld/trunk/lib/ReaderWriter/FileArchive.cpp

Modified: lld/trunk/lib/ReaderWriter/FileArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/FileArchive.cpp?rev=210175&r1=210174&r2=210175&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/FileArchive.cpp (original)
+++ lld/trunk/lib/ReaderWriter/FileArchive.cpp Wed Jun  4 04:09:06 2014
@@ -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:





More information about the llvm-commits mailing list