Coverage Report

Created: 2019-05-19 14:56

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