clang 24.0.0git
Tool.h
Go to the documentation of this file.
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
14namespace llvm {
15namespace opt {
16 class ArgList;
17}
18}
19
20namespace clang {
21namespace driver {
22
23 class Compilation;
24 class InputInfo;
25 class JobAction;
26 class ToolChain;
27
28 typedef SmallVector<InputInfo, 4> InputInfoList;
29
30/// Tool - Information on a specific compilation tool.
31class Tool {
32 /// The tool name (for debugging).
33 const char *Name;
34
35 /// The human readable name for the tool, for use in diagnostics.
36 const char *ShortName;
37
38 /// The tool chain this tool is a part of.
39 const ToolChain &TheToolChain;
40
41public:
42 Tool(const char *Name, const char *ShortName, const ToolChain &TC);
43
44public:
45 virtual ~Tool();
46
47 const char *getName() const { return Name; }
48
49 const char *getShortName() const { return ShortName; }
50
51 const ToolChain &getToolChain() const { return TheToolChain; }
52
53 virtual bool hasIntegratedAssembler() const { return false; }
54 virtual bool hasIntegratedBackend() const { return true; }
55 virtual bool canEmitIR() const { return false; }
56 virtual bool hasIntegratedCPP() const = 0;
57 virtual bool isLinkJob() const { return false; }
58 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 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};
78
79} // end namespace driver
80} // end namespace clang
81
82#endif
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Compilation - A set of tasks to perform for a single driver invocation.
Definition Compilation.h:46
InputInfo - Wrapper for information about an input source.
Definition InputInfo.h:22
ToolChain - Access to tools for a single platform.
Definition ToolChain.h:92
virtual bool hasIntegratedAssembler() const
Definition Tool.h:53
virtual bool isDsymutilJob() const
Definition Tool.h:58
const ToolChain & getToolChain() const
Definition Tool.h:51
virtual bool canEmitIR() const
Definition Tool.h:55
virtual ~Tool()
Definition Tool.cpp:16
Tool(const char *Name, const char *ShortName, const ToolChain &TC)
Definition Tool.cpp:13
virtual bool hasGoodDiagnostics() const
Does this tool have "good" standardized diagnostics, or should the driver add an additional "command ...
Definition Tool.h:62
const char * getName() const
Definition Tool.h:47
virtual bool hasIntegratedBackend() const
Definition Tool.h:54
virtual bool isLinkJob() const
Definition Tool.h:57
virtual bool hasIntegratedCPP() const =0
virtual void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &TCArgs, const char *LinkingOutput) const =0
ConstructJob - Construct jobs to perform the action JA, writing to Output and with Inputs,...
const char * getShortName() const
Definition Tool.h:49
SmallVector< InputInfo, 4 > InputInfoList
Definition Driver.h:49
Top level wrappers for InstallAPI frontend operations.
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30