1 //===- Core/ArchiveLibraryFile.h - Models static library ------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLD_CORE_ARCHIVE_LIBRARY_FILE_H
10 #define LLD_CORE_ARCHIVE_LIBRARY_FILE_H
12 #include "lld/Core/File.h"
18 /// The ArchiveLibraryFile subclass of File is used to represent unix
19 /// static library archives. These libraries provide no atoms to the
20 /// initial set of atoms linked. Instead, when the Resolver will query
21 /// ArchiveLibraryFile instances for specific symbols names using the
22 /// find() method. If the archive contains an object file which has a
23 /// DefinedAtom whose scope is not translationUnit, then that entire
24 /// object file File is returned.
26 class ArchiveLibraryFile : public File {
28 static bool classof(const File *f) {
29 return f->kind() == kindArchiveLibrary;
32 /// Check if any member of the archive contains an Atom with the
33 /// specified name and return the File object for that member, or nullptr.
34 virtual File *find(StringRef name) = 0;
36 virtual std::error_code
37 parseAllMembers(std::vector<std::unique_ptr<File>> &result) = 0;
40 /// only subclasses of ArchiveLibraryFile can be instantiated
41 ArchiveLibraryFile(StringRef path) : File(path, kindArchiveLibrary) {}
46 #endif // LLD_CORE_ARCHIVE_LIBRARY_FILE_H