]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lld/include/lld/Core/ArchiveLibraryFile.h
Update mandoc to cvs snapshot 2019-07-23
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lld / include / lld / Core / ArchiveLibraryFile.h
1 //===- Core/ArchiveLibraryFile.h - Models static library ------------------===//
2 //
3 //                             The LLVM Linker
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLD_CORE_ARCHIVE_LIBRARY_FILE_H
11 #define LLD_CORE_ARCHIVE_LIBRARY_FILE_H
12
13 #include "lld/Core/File.h"
14 #include <set>
15
16 namespace lld {
17
18 ///
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.
26 ///
27 class ArchiveLibraryFile : public File {
28 public:
29   static bool classof(const File *f) {
30     return f->kind() == kindArchiveLibrary;
31   }
32
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;
36
37   virtual std::error_code
38   parseAllMembers(std::vector<std::unique_ptr<File>> &result) = 0;
39
40 protected:
41   /// only subclasses of ArchiveLibraryFile can be instantiated
42   ArchiveLibraryFile(StringRef path) : File(path, kindArchiveLibrary) {}
43 };
44
45 } // namespace lld
46
47 #endif // LLD_CORE_ARCHIVE_LIBRARY_FILE_H