Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:53

0001 //===--- Tool.h - Compilation Tools -----------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CLANG_DRIVER_TOOL_H
0010 #define LLVM_CLANG_DRIVER_TOOL_H
0011 
0012 #include "clang/Basic/LLVM.h"
0013 
0014 namespace llvm {
0015 namespace opt {
0016   class ArgList;
0017 }
0018 }
0019 
0020 namespace clang {
0021 namespace driver {
0022 
0023   class Compilation;
0024   class InputInfo;
0025   class Job;
0026   class JobAction;
0027   class ToolChain;
0028 
0029   typedef SmallVector<InputInfo, 4> InputInfoList;
0030 
0031 /// Tool - Information on a specific compilation tool.
0032 class Tool {
0033   /// The tool name (for debugging).
0034   const char *Name;
0035 
0036   /// The human readable name for the tool, for use in diagnostics.
0037   const char *ShortName;
0038 
0039   /// The tool chain this tool is a part of.
0040   const ToolChain &TheToolChain;
0041 
0042 public:
0043   Tool(const char *Name, const char *ShortName, const ToolChain &TC);
0044 
0045 public:
0046   virtual ~Tool();
0047 
0048   const char *getName() const { return Name; }
0049 
0050   const char *getShortName() const { return ShortName; }
0051 
0052   const ToolChain &getToolChain() const { return TheToolChain; }
0053 
0054   virtual bool hasIntegratedAssembler() const { return false; }
0055   virtual bool hasIntegratedBackend() const { return true; }
0056   virtual bool canEmitIR() const { return false; }
0057   virtual bool hasIntegratedCPP() const = 0;
0058   virtual bool isLinkJob() const { return false; }
0059   virtual bool isDsymutilJob() const { return false; }
0060 
0061   /// Does this tool have "good" standardized diagnostics, or should the
0062   /// driver add an additional "command failed" diagnostic on failures.
0063   virtual bool hasGoodDiagnostics() const { return false; }
0064 
0065   /// ConstructJob - Construct jobs to perform the action \p JA,
0066   /// writing to \p Output and with \p Inputs, and add the jobs to
0067   /// \p C.
0068   ///
0069   /// \param TCArgs - The argument list for this toolchain, with any
0070   /// tool chain specific translations applied.
0071   /// \param LinkingOutput - If this output will eventually feed the
0072   /// linker, then this is the final output name of the linked image.
0073   virtual void ConstructJob(Compilation &C, const JobAction &JA,
0074                             const InputInfo &Output,
0075                             const InputInfoList &Inputs,
0076                             const llvm::opt::ArgList &TCArgs,
0077                             const char *LinkingOutput) const = 0;
0078   /// Construct jobs to perform the action \p JA, writing to the \p Outputs and
0079   /// with \p Inputs, and add the jobs to \p C. The default implementation
0080   /// assumes a single output and is expected to be overloaded for the tools
0081   /// that support multiple inputs.
0082   ///
0083   /// \param TCArgs The argument list for this toolchain, with any
0084   /// tool chain specific translations applied.
0085   /// \param LinkingOutput If this output will eventually feed the
0086   /// linker, then this is the final output name of the linked image.
0087   virtual void ConstructJobMultipleOutputs(Compilation &C, const JobAction &JA,
0088                                            const InputInfoList &Outputs,
0089                                            const InputInfoList &Inputs,
0090                                            const llvm::opt::ArgList &TCArgs,
0091                                            const char *LinkingOutput) const;
0092 };
0093 
0094 } // end namespace driver
0095 } // end namespace clang
0096 
0097 #endif