1 //===--- Tool.h - Compilation Tools -----------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_DRIVER_TOOL_H
10 #define LLVM_CLANG_DRIVER_TOOL_H
12 #include "clang/Basic/LLVM.h"
29 typedef SmallVector<InputInfo, 4> InputInfoList;
31 /// Tool - Information on a specific compilation tool.
33 /// The tool name (for debugging).
36 /// The human readable name for the tool, for use in diagnostics.
37 const char *ShortName;
39 /// The tool chain this tool is a part of.
40 const ToolChain &TheToolChain;
43 Tool(const char *Name, const char *ShortName, const ToolChain &TC);
48 const char *getName() const { return Name; }
50 const char *getShortName() const { return ShortName; }
52 const ToolChain &getToolChain() const { return TheToolChain; }
54 virtual bool hasIntegratedAssembler() const { return false; }
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; }
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; }
64 /// ConstructJob - Construct jobs to perform the action \p JA,
65 /// writing to \p Output and with \p Inputs, and add the jobs to
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.
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;
93 } // end namespace driver
94 } // end namespace clang