Coverage Report

Created: 2020-09-15 12:33

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/Driver/Tool.h
Line
Count
Source (jump to first uncovered line)
1
//===--- Tool.h - Compilation Tools -----------------------------*- 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_CLANG_DRIVER_TOOL_H
10
#define LLVM_CLANG_DRIVER_TOOL_H
11
12
#include "clang/Basic/LLVM.h"
13
14
namespace llvm {
15
namespace opt {
16
  class ArgList;
17
}
18
}
19
20
namespace clang {
21
namespace driver {
22
23
  class Compilation;
24
  class InputInfo;
25
  class Job;
26
  class JobAction;
27
  class ToolChain;
28
29
  typedef SmallVector<InputInfo, 4> InputInfoList;
30
31
/// Tool - Information on a specific compilation tool.
32
class Tool {
33
  /// The tool name (for debugging).
34
  const char *Name;
35
36
  /// The human readable name for the tool, for use in diagnostics.
37
  const char *ShortName;
38
39
  /// The tool chain this tool is a part of.
40
  const ToolChain &TheToolChain;
41
42
public:
43
  Tool(const char *Name, const char *ShortName, const ToolChain &TC);
44
45
public:
46
  virtual ~Tool();
47
48
26.3k
  const char *getName() const { return Name; }
49
50
312
  const char *getShortName() const { return ShortName; }
51
52
530k
  const ToolChain &getToolChain() const { return TheToolChain; }
53
54
0
  virtual bool hasIntegratedAssembler() const { return false; }
55
7
  virtual bool canEmitIR() const { return false; }
56
  virtual bool hasIntegratedCPP() const = 0;
57
27
  virtual bool isLinkJob() const { return false; }
58
27
  virtual bool isDsymutilJob() const { return false; }
59
60
  /// Does this tool have "good" standardized diagnostics, or should the
61
  /// driver add an additional "command failed" diagnostic on failures.
62
50
  virtual bool hasGoodDiagnostics() const { return false; }
63
64
  /// ConstructJob - Construct jobs to perform the action \p JA,
65
  /// writing to \p Output and with \p Inputs, and add the jobs to
66
  /// \p C.
67
  ///
68
  /// \param TCArgs - The argument list for this toolchain, with any
69
  /// tool chain specific translations applied.
70
  /// \param LinkingOutput - If this output will eventually feed the
71
  /// linker, then this is the final output name of the linked image.
72
  virtual void ConstructJob(Compilation &C, const JobAction &JA,
73
                            const InputInfo &Output,
74
                            const InputInfoList &Inputs,
75
                            const llvm::opt::ArgList &TCArgs,
76
                            const char *LinkingOutput) const = 0;
77
  /// Construct jobs to perform the action \p JA, writing to the \p Outputs and
78
  /// with \p Inputs, and add the jobs to \p C. The default implementation
79
  /// assumes a single output and is expected to be overloaded for the tools
80
  /// that support multiple inputs.
81
  ///
82
  /// \param TCArgs The argument list for this toolchain, with any
83
  /// tool chain specific translations applied.
84
  /// \param LinkingOutput If this output will eventually feed the
85
  /// linker, then this is the final output name of the linked image.
86
  virtual void ConstructJobMultipleOutputs(Compilation &C, const JobAction &JA,
87
                                           const InputInfoList &Outputs,
88
                                           const InputInfoList &Inputs,
89
                                           const llvm::opt::ArgList &TCArgs,
90
                                           const char *LinkingOutput) const;
91
};
92
93
} // end namespace driver
94
} // end namespace clang
95
96
#endif