+ // The serial number of the file in the argument list.
+ unsigned int arg_serial_;
+};
+
+// This class serves as a base class for Archive and Lib_group objects.
+
+class Library_base
+{
+ public:
+ Library_base(Task* task)
+ : task_(task), incremental_info_(NULL)
+ { }
+
+ virtual
+ ~Library_base()
+ { }
+
+ // The file name.
+ const std::string&
+ filename() const
+ { return this->do_filename(); }
+
+ // The modification time of the archive file.
+ Timespec
+ get_mtime()
+ { return this->do_get_mtime(); }
+
+ // When we see a symbol in an archive we might decide to include the member,
+ // not include the member or be undecided. This enum represents these
+ // possibilities.
+
+ enum Should_include
+ {
+ SHOULD_INCLUDE_NO,
+ SHOULD_INCLUDE_YES,
+ SHOULD_INCLUDE_UNKNOWN
+ };
+
+ static Should_include
+ should_include_member(Symbol_table* symtab, Layout*, const char* sym_name,
+ Symbol** symp, std::string* why, char** tmpbufp,
+ size_t* tmpbuflen);
+
+ // Store a pointer to the incremental link info for the library.
+ void
+ set_incremental_info(Incremental_archive_entry* info)
+ { this->incremental_info_ = info; }
+
+ // Return the pointer to the incremental link info for the library.
+ Incremental_archive_entry*
+ incremental_info() const
+ { return this->incremental_info_; }
+
+ // Abstract base class for processing unused symbols.
+ class Symbol_visitor_base
+ {
+ public:
+ Symbol_visitor_base()
+ { }
+
+ virtual
+ ~Symbol_visitor_base()
+ { }
+
+ // This function will be called for each unused global
+ // symbol in a library, with a pointer to the symbol name.
+ virtual void
+ visit(const char* /* name */) = 0;
+ };
+
+ // Iterator for unused global symbols in the library.
+ // Calls v->visit() for each global symbol defined
+ // in each unused library member, passing a pointer to
+ // the symbol name.
+ void
+ for_all_unused_symbols(Symbol_visitor_base* v) const
+ { this->do_for_all_unused_symbols(v); }
+
+ protected:
+ // The task reading this archive.
+ Task *task_;
+
+ private:
+ // The file name.
+ virtual const std::string&
+ do_filename() const = 0;
+
+ // Return the modification time of the archive file.
+ virtual Timespec
+ do_get_mtime() = 0;
+
+ // Iterator for unused global symbols in the library.
+ virtual void
+ do_for_all_unused_symbols(Symbol_visitor_base* v) const = 0;
+
+ // The incremental link information for this archive.
+ Incremental_archive_entry* incremental_info_;