Coverage Report

Created: 2018-06-25 02:00

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/lld/lib/ReaderWriter/MachO/FlatNamespaceFile.h
Line
Count
Source
1
//===- lib/ReaderWriter/MachO/FlatNamespaceFile.h -------------------------===//
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_READER_WRITER_MACHO_FLAT_NAMESPACE_FILE_H
11
#define LLD_READER_WRITER_MACHO_FLAT_NAMESPACE_FILE_H
12
13
#include "Atoms.h"
14
#include "lld/Core/SharedLibraryFile.h"
15
#include "lld/ReaderWriter/MachOLinkingContext.h"
16
#include "llvm/Support/Debug.h"
17
18
namespace lld {
19
namespace mach_o {
20
21
//
22
// A FlateNamespaceFile instance may be added as a resolution source of last
23
// resort, depending on how -flat_namespace and -undefined are set.
24
//
25
class FlatNamespaceFile : public SharedLibraryFile {
26
public:
27
  FlatNamespaceFile(const MachOLinkingContext &context)
28
2
    : SharedLibraryFile("flat namespace") { }
29
30
4
  OwningAtomPtr<SharedLibraryAtom> exports(StringRef name) const override {
31
4
    return new (allocator()) MachOSharedLibraryAtom(*this, name, getDSOName(),
32
4
                                                    false);
33
4
  }
34
35
4
  StringRef getDSOName() const override { return "flat-namespace"; }
36
37
2
  const AtomRange<DefinedAtom> defined() const override {
38
2
    return _noDefinedAtoms;
39
2
  }
40
2
  const AtomRange<UndefinedAtom> undefined() const override {
41
2
    return _noUndefinedAtoms;
42
2
  }
43
44
2
  const AtomRange<SharedLibraryAtom> sharedLibrary() const override {
45
2
    return _noSharedLibraryAtoms;
46
2
  }
47
48
2
  const AtomRange<AbsoluteAtom> absolute() const override {
49
2
    return _noAbsoluteAtoms;
50
2
  }
51
52
2
  void clearAtoms() override {
53
2
    _noDefinedAtoms.clear();
54
2
    _noUndefinedAtoms.clear();
55
2
    _noSharedLibraryAtoms.clear();
56
2
    _noAbsoluteAtoms.clear();
57
2
  }
58
};
59
60
} // namespace mach_o
61
} // namespace lld
62
63
#endif // LLD_READER_WRITER_MACHO_FLAT_NAMESPACE_FILE_H