Coverage Report

Created: 2017-09-19 22:28

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/lld/include/lld/Core/Writer.h
Line
Count
Source (jump to first uncovered line)
1
//===- lld/Core/Writer.h - Abstract File Format Interface -----------------===//
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_WRITER_H
11
#define LLD_CORE_WRITER_H
12
13
#include "lld/Core/LLVM.h"
14
#include "llvm/Support/Error.h"
15
#include <memory>
16
#include <vector>
17
18
namespace lld {
19
class File;
20
class LinkingContext;
21
class MachOLinkingContext;
22
23
/// \brief The Writer is an abstract class for writing object files, shared
24
/// library files, and executable files.  Each file format (e.g. mach-o, etc)
25
/// has a concrete subclass of Writer.
26
class Writer {
27
public:
28
  virtual ~Writer();
29
30
  /// \brief Write a file from the supplied File object
31
  virtual llvm::Error writeFile(const File &linkedFile, StringRef path) = 0;
32
33
  /// \brief This method is called by Core Linking to give the Writer a chance
34
  /// to add file format specific "files" to set of files to be linked. This is
35
  /// how file format specific atoms can be added to the link.
36
0
  virtual void createImplicitFiles(std::vector<std::unique_ptr<File>> &) {}
37
38
protected:
39
  // only concrete subclasses can be instantiated
40
  Writer();
41
};
42
43
std::unique_ptr<Writer> createWriterMachO(const MachOLinkingContext &);
44
std::unique_ptr<Writer> createWriterYAML(const LinkingContext &);
45
} // end namespace lld
46
47
#endif