Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/MC/MCWinCOFFObjectWriter.h
Line
Count
Source (jump to first uncovered line)
1
//===- llvm/MC/MCWinCOFFObjectWriter.h - Win COFF Object Writer -*- C++ -*-===//
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 LLVM_MC_MCWINCOFFOBJECTWRITER_H
10
#define LLVM_MC_MCWINCOFFOBJECTWRITER_H
11
12
#include "llvm/MC/MCObjectWriter.h"
13
#include <memory>
14
15
namespace llvm {
16
17
class MCAsmBackend;
18
class MCContext;
19
class MCFixup;
20
class MCValue;
21
class raw_pwrite_stream;
22
23
  class MCWinCOFFObjectTargetWriter : public MCObjectTargetWriter {
24
    virtual void anchor();
25
26
    const unsigned Machine;
27
28
  protected:
29
    MCWinCOFFObjectTargetWriter(unsigned Machine_);
30
31
  public:
32
1.26k
    virtual ~MCWinCOFFObjectTargetWriter() = default;
33
34
1.27k
    virtual Triple::ObjectFormatType getFormat() const { return Triple::COFF; }
35
0
    static bool classof(const MCObjectTargetWriter *W) {
36
0
      return W->getFormat() == Triple::COFF;
37
0
    }
38
39
6.67k
    unsigned getMachine() const { return Machine; }
40
    virtual unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
41
                                  const MCFixup &Fixup, bool IsCrossSection,
42
                                  const MCAsmBackend &MAB) const = 0;
43
4.06k
    virtual bool recordRelocation(const MCFixup &) const { return true; }
44
  };
45
46
  /// Construct a new Win COFF writer instance.
47
  ///
48
  /// \param MOTW - The target specific WinCOFF writer subclass.
49
  /// \param OS - The stream to write to.
50
  /// \returns The constructed object writer.
51
  std::unique_ptr<MCObjectWriter>
52
  createWinCOFFObjectWriter(std::unique_ptr<MCWinCOFFObjectTargetWriter> MOTW,
53
                            raw_pwrite_stream &OS);
54
} // end namespace llvm
55
56
#endif // LLVM_MC_MCWINCOFFOBJECTWRITER_H