Coverage Report

Created: 2019-07-24 05:18

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