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
13226633Sdim#include "clang/Basic/LLVM.h"
14193326Sed
15193326Sednamespace clang {
16193326Sednamespace driver {
17193326Sed  class ArgList;
18193326Sed  class Compilation;
19193326Sed  class InputInfo;
20193326Sed  class Job;
21193326Sed  class JobAction;
22193326Sed  class ToolChain;
23198092Srdivacky
24226633Sdim  typedef SmallVector<InputInfo, 4> InputInfoList;
25193326Sed
26193326Sed/// Tool - Information on a specific compilation tool.
27193326Sedclass Tool {
28193326Sed  /// The tool name (for debugging).
29193326Sed  const char *Name;
30193326Sed
31208600Srdivacky  /// The human readable name for the tool, for use in diagnostics.
32208600Srdivacky  const char *ShortName;
33208600Srdivacky
34193326Sed  /// The tool chain this tool is a part of.
35193326Sed  const ToolChain &TheToolChain;
36193326Sed
37193326Sedpublic:
38208600Srdivacky  Tool(const char *Name, const char *ShortName,
39208600Srdivacky       const ToolChain &TC);
40193326Sed
41193326Sedpublic:
42193326Sed  virtual ~Tool();
43193326Sed
44193326Sed  const char *getName() const { return Name; }
45193326Sed
46208600Srdivacky  const char *getShortName() const { return ShortName; }
47208600Srdivacky
48193326Sed  const ToolChain &getToolChain() const { return TheToolChain; }
49193326Sed
50203955Srdivacky  virtual bool hasIntegratedAssembler() const { return false; }
51193326Sed  virtual bool hasIntegratedCPP() const = 0;
52234353Sdim  virtual bool isLinkJob() const { return false; }
53249423Sdim  virtual bool isDsymutilJob() const { return false; }
54193326Sed
55207619Srdivacky  /// \brief Does this tool have "good" standardized diagnostics, or should the
56207619Srdivacky  /// driver add an additional "command failed" diagnostic on failures.
57207619Srdivacky  virtual bool hasGoodDiagnostics() const { return false; }
58207619Srdivacky
59243830Sdim  /// ConstructJob - Construct jobs to perform the action \p JA,
60243830Sdim  /// writing to \p Output and with \p Inputs.
61193326Sed  ///
62193326Sed  /// \param TCArgs - The argument list for this toolchain, with any
63193326Sed  /// tool chain specific translations applied.
64193326Sed  /// \param LinkingOutput - If this output will eventually feed the
65193326Sed  /// linker, then this is the final output name of the linked image.
66193326Sed  virtual void ConstructJob(Compilation &C, const JobAction &JA,
67198092Srdivacky                            const InputInfo &Output,
68198092Srdivacky                            const InputInfoList &Inputs,
69198092Srdivacky                            const ArgList &TCArgs,
70193326Sed                            const char *LinkingOutput) const = 0;
71193326Sed};
72193326Sed
73193326Sed} // end namespace driver
74193326Sed} // end namespace clang
75193326Sed
76193326Sed#endif
77