Coverage Report

Created: 2019-07-24 05:18

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