Coverage Report

Created: 2017-09-19 22:28

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/lld/include/lld/Core/SharedLibraryFile.h
Line
Count
Source
1
//===- Core/SharedLibraryFile.h - Models shared libraries as Atoms --------===//
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_SHARED_LIBRARY_FILE_H
11
#define LLD_CORE_SHARED_LIBRARY_FILE_H
12
13
#include "lld/Core/File.h"
14
15
namespace lld {
16
17
///
18
/// The SharedLibraryFile subclass of File is used to represent dynamic
19
/// shared libraries being linked against.
20
///
21
class SharedLibraryFile : public File {
22
public:
23
2.11k
  static bool classof(const File *f) {
24
2.11k
    return f->kind() == kindSharedLibrary;
25
2.11k
  }
26
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;
31
32
  // Returns the install name.
33
  virtual StringRef getDSOName() const = 0;
34
35
116
  const AtomRange<DefinedAtom> defined() const override {
36
116
    return _definedAtoms;
37
116
  }
38
39
116
  const AtomRange<UndefinedAtom> undefined() const override {
40
116
    return _undefinedAtoms;
41
116
  }
42
43
116
  const AtomRange<SharedLibraryAtom> sharedLibrary() const override {
44
116
    return _sharedLibraryAtoms;
45
116
  }
46
47
116
  const AtomRange<AbsoluteAtom> absolute() const override {
48
116
    return _absoluteAtoms;
49
116
  }
50
51
116
  void clearAtoms() override {
52
116
    _definedAtoms.clear();
53
116
    _undefinedAtoms.clear();
54
116
    _sharedLibraryAtoms.clear();
55
116
    _absoluteAtoms.clear();
56
116
  }
57
58
protected:
59
  /// only subclasses of SharedLibraryFile can be instantiated
60
118
  explicit SharedLibraryFile(StringRef path) : File(path, kindSharedLibrary) {}
61
62
  AtomVector<DefinedAtom> _definedAtoms;
63
  AtomVector<UndefinedAtom> _undefinedAtoms;
64
  AtomVector<SharedLibraryAtom> _sharedLibraryAtoms;
65
  AtomVector<AbsoluteAtom> _absoluteAtoms;
66
};
67
68
} // namespace lld
69
70
#endif // LLD_CORE_SHARED_LIBRARY_FILE_H