1193326Sed//===--- Tool.h - Compilation Tools -----------------------------*- C++ -*-===//
2193326Sed//
3193326Sed//                     The LLVM Compiler Infrastructure
4193326Sed//
5193326Sed// This file is distributed under the University of Illinois Open Source
6193326Sed// License. See LICENSE.TXT for details.
7193326Sed//
8193326Sed//===----------------------------------------------------------------------===//
9193326Sed
10193326Sed#ifndef CLANG_DRIVER_TOOL_H_
11193326Sed#define CLANG_DRIVER_TOOL_H_
12193326Sed
13226890Sdim#include "clang/Basic/LLVM.h"
14193326Sed
15263509Sdimnamespace llvm {
16263509Sdimnamespace opt {
17263509Sdim  class ArgList;
18263509Sdim}
19263509Sdim}
20263509Sdim
21193326Sednamespace clang {
22193326Sednamespace driver {
23263509Sdim
24193326Sed  class Compilation;
25193326Sed  class InputInfo;
26193326Sed  class Job;
27193326Sed  class JobAction;
28193326Sed  class ToolChain;
29198092Srdivacky
30226890Sdim  typedef SmallVector<InputInfo, 4> InputInfoList;
31193326Sed
32193326Sed/// Tool - Information on a specific compilation tool.
33193326Sedclass Tool {
34193326Sed  /// The tool name (for debugging).
35193326Sed  const char *Name;
36193326Sed
37208600Srdivacky  /// The human readable name for the tool, for use in diagnostics.
38208600Srdivacky  const char *ShortName;
39208600Srdivacky
40193326Sed  /// The tool chain this tool is a part of.
41193326Sed  const ToolChain &TheToolChain;
42193326Sed
43193326Sedpublic:
44208600Srdivacky  Tool(const char *Name, const char *ShortName,
45208600Srdivacky       const ToolChain &TC);
46193326Sed
47193326Sedpublic:
48193326Sed  virtual ~Tool();
49193326Sed
50193326Sed  const char *getName() const { return Name; }
51193326Sed
52208600Srdivacky  const char *getShortName() const { return ShortName; }
53208600Srdivacky
54193326Sed  const ToolChain &getToolChain() const { return TheToolChain; }
55193326Sed
56203955Srdivacky  virtual bool hasIntegratedAssembler() const { return false; }
57193326Sed  virtual bool hasIntegratedCPP() const = 0;
58235633Sdim  virtual bool isLinkJob() const { return false; }
59252723Sdim  virtual bool isDsymutilJob() const { return false; }
60193326Sed
61207619Srdivacky  /// \brief Does this tool have "good" standardized diagnostics, or should the
62207619Srdivacky  /// driver add an additional "command failed" diagnostic on failures.
63207619Srdivacky  virtual bool hasGoodDiagnostics() const { return false; }
64207619Srdivacky
65245431Sdim  /// ConstructJob - Construct jobs to perform the action \p JA,
66263509Sdim  /// writing to \p Output and with \p Inputs, and add the jobs to
67263509Sdim  /// \p C.
68193326Sed  ///
69193326Sed  /// \param TCArgs - The argument list for this toolchain, with any
70193326Sed  /// tool chain specific translations applied.
71193326Sed  /// \param LinkingOutput - If this output will eventually feed the
72193326Sed  /// linker, then this is the final output name of the linked image.
73193326Sed  virtual void ConstructJob(Compilation &C, const JobAction &JA,
74198092Srdivacky                            const InputInfo &Output,
75198092Srdivacky                            const InputInfoList &Inputs,
76263509Sdim                            const llvm::opt::ArgList &TCArgs,
77193326Sed                            const char *LinkingOutput) const = 0;
78193326Sed};
79193326Sed
80193326Sed} // end namespace driver
81193326Sed} // end namespace clang
82193326Sed
83193326Sed#endif
84