1 //===- Core/ArchiveLibraryFile.h - Models static library ------------------===//
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLD_CORE_ARCHIVE_LIBRARY_FILE_H
11 #define LLD_CORE_ARCHIVE_LIBRARY_FILE_H
13 #include "lld/Core/File.h"
19 /// The ArchiveLibraryFile subclass of File is used to represent unix
20 /// static library archives. These libraries provide no atoms to the
21 /// initial set of atoms linked. Instead, when the Resolver will query
22 /// ArchiveLibraryFile instances for specific symbols names using the
23 /// find() method. If the archive contains an object file which has a
24 /// DefinedAtom whose scope is not translationUnit, then that entire
25 /// object file File is returned.
27 class ArchiveLibraryFile : public File {
29 static bool classof(const File *f) {
30 return f->kind() == kindArchiveLibrary;
33 /// Check if any member of the archive contains an Atom with the
34 /// specified name and return the File object for that member, or nullptr.
35 virtual File *find(StringRef name) = 0;
37 virtual std::error_code
38 parseAllMembers(std::vector<std::unique_ptr<File>> &result) = 0;
41 /// only subclasses of ArchiveLibraryFile can be instantiated
42 ArchiveLibraryFile(StringRef path) : File(path, kindArchiveLibrary) {}
47 #endif // LLD_CORE_ARCHIVE_LIBRARY_FILE_H