1 //===- Core/SharedLibraryFile.h - Models shared libraries as Atoms --------===//
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLD_CORE_SHARED_LIBRARY_FILE_H
11 #define LLD_CORE_SHARED_LIBRARY_FILE_H
13 #include "lld/Core/File.h"
18 /// The SharedLibraryFile subclass of File is used to represent dynamic
19 /// shared libraries being linked against.
21 class SharedLibraryFile : public File {
23 static bool classof(const File *f) {
24 return f->kind() == kindSharedLibrary;
27 /// Check if the shared library exports a symbol with the specified name.
28 /// If so, return a SharedLibraryAtom which represents that exported
29 /// symbol. Otherwise return nullptr.
30 virtual OwningAtomPtr<SharedLibraryAtom> exports(StringRef name) const = 0;
32 // Returns the install name.
33 virtual StringRef getDSOName() const = 0;
35 const AtomRange<DefinedAtom> defined() const override {
39 const AtomRange<UndefinedAtom> undefined() const override {
40 return _undefinedAtoms;
43 const AtomRange<SharedLibraryAtom> sharedLibrary() const override {
44 return _sharedLibraryAtoms;
47 const AtomRange<AbsoluteAtom> absolute() const override {
48 return _absoluteAtoms;
51 void clearAtoms() override {
52 _definedAtoms.clear();
53 _undefinedAtoms.clear();
54 _sharedLibraryAtoms.clear();
55 _absoluteAtoms.clear();
59 /// only subclasses of SharedLibraryFile can be instantiated
60 explicit SharedLibraryFile(StringRef path) : File(path, kindSharedLibrary) {}
62 AtomVector<DefinedAtom> _definedAtoms;
63 AtomVector<UndefinedAtom> _undefinedAtoms;
64 AtomVector<SharedLibraryAtom> _sharedLibraryAtoms;
65 AtomVector<AbsoluteAtom> _absoluteAtoms;
70 #endif // LLD_CORE_SHARED_LIBRARY_FILE_H