Tool.h revision 203955
1//===--- Tool.h - Compilation Tools -----------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef CLANG_DRIVER_TOOL_H_
11#define CLANG_DRIVER_TOOL_H_
12
13namespace llvm {
14  template<typename T, unsigned N> class SmallVector;
15}
16
17namespace clang {
18namespace driver {
19  class ArgList;
20  class Compilation;
21  class InputInfo;
22  class Job;
23  class JobAction;
24  class ToolChain;
25
26  typedef llvm::SmallVector<InputInfo, 4> InputInfoList;
27
28/// Tool - Information on a specific compilation tool.
29class Tool {
30  /// The tool name (for debugging).
31  const char *Name;
32
33  /// The tool chain this tool is a part of.
34  const ToolChain &TheToolChain;
35
36public:
37  Tool(const char *Name, const ToolChain &TC);
38
39public:
40  virtual ~Tool();
41
42  const char *getName() const { return Name; }
43
44  const ToolChain &getToolChain() const { return TheToolChain; }
45
46  virtual bool acceptsPipedInput() const = 0;
47  virtual bool canPipeOutput() const = 0;
48  virtual bool hasIntegratedAssembler() const { return false; }
49  virtual bool hasIntegratedCPP() const = 0;
50
51  /// ConstructJob - Construct jobs to perform the action \arg JA,
52  /// writing to \arg Output and with \arg Inputs.
53  ///
54  /// \param Dest - Where to put the resulting commands.
55  /// \param TCArgs - The argument list for this toolchain, with any
56  /// tool chain specific translations applied.
57  /// \param LinkingOutput - If this output will eventually feed the
58  /// linker, then this is the final output name of the linked image.
59  virtual void ConstructJob(Compilation &C, const JobAction &JA,
60                            Job &Dest,
61                            const InputInfo &Output,
62                            const InputInfoList &Inputs,
63                            const ArgList &TCArgs,
64                            const char *LinkingOutput) const = 0;
65};
66
67} // end namespace driver
68} // end namespace clang
69
70#endif
71