clang 8.0.0

Public Types | Public Member Functions | List of all members
clang::driver::Tool Class Referenceabstract

Tool - Information on a specific compilation tool. More...

`#include "clang/Driver/Tool.h"`

Inheritance diagram for clang::driver::Tool:
[legend]

## Public Types
enum | ResponseFileSupport { RF_Full, RF_FileList, RF_None }

## Public Member Functions
| Tool (const char *Name, const char *ShortName, const ToolChain &TC, ResponseFileSupport ResponseSupport=RF_None, llvm::sys::WindowsEncodingMethod ResponseEncoding=llvm::sys::WEM_UTF8, const char *ResponseFlag="@")
virtual | ~Tool ()
const char * | getName () const
const char * | getShortName () const
const ToolChain & | getToolChain () const
virtual bool | hasIntegratedAssembler () const
virtual bool | canEmitIR () const
virtual bool | hasIntegratedCPP () const =0
virtual bool | isLinkJob () const
virtual bool | isDsymutilJob () const
ResponseFileSupport | getResponseFilesSupport () const
| Returns the level of support for response files of this tool, whether it accepts arguments to be passed via a file on disk. More...
llvm::sys::WindowsEncodingMethod | getResponseFileEncoding () const
| Returns which encoding the response file should use. More...
const char * | getResponseFileFlag () const
| Returns which prefix to use when passing the name of a response file as a parameter to this tool. More...
virtual bool | hasGoodDiagnostics () const
| Does this tool have "good" standardized diagnostics, or should the driver add an additional "command failed" diagnostic on failures. More...
virtual void | ConstructJob (Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &TCArgs, const char *LinkingOutput) const =0
| ConstructJob - Construct jobs to perform the action `JA`, writing to `Output` and with `Inputs`, and add the jobs to `C`. More...
virtual void | ConstructJobMultipleOutputs (Compilation &C, const JobAction &JA, const InputInfoList &Outputs, const InputInfoList &Inputs, const llvm::opt::ArgList &TCArgs, const char *LinkingOutput) const
| Construct jobs to perform the action `JA`, writing to the `Outputs` and with `Inputs`, and add the jobs to `C`. More...

## Detailed Description

Tool - Information on a specific compilation tool.

Definition at line 34 of file Tool.h.

## Member Enumeration Documentation

## ◆ ResponseFileSupport

enum clang::driver::Tool::ResponseFileSupport

Enumerator
RF_Full |
RF_FileList |
RF_None |

Definition at line 39 of file Tool.h.

## Constructor & Destructor Documentation

## ◆ Tool()

Tool::Tool | ( | const char * | Name,
|  | const char * | ShortName,
|  | const ToolChain & | TC,
|  | ResponseFileSupport | ResponseSupport = `RF_None`,
|  | llvm::sys::WindowsEncodingMethod | ResponseEncoding = `llvm::sys::WEM_UTF8`,
|  | const char * | ResponseFlag = `"@"`
| ) |  |

Definition at line 15 of file Tool.cpp.

## ◆ ~Tool()

Tool::~Tool | ( |  | ) |
| virtual

Definition at line 23 of file Tool.cpp.

## Member Function Documentation

## ◆ canEmitIR()

virtual bool clang::driver::Tool::canEmitIR | ( |  | ) | const
| inline virtual

Reimplemented in clang::driver::tools::Clang.

Definition at line 87 of file Tool.h.

Referenced by clang::driver::Driver::BuildJobs().

## ◆ ConstructJob()

virtual void clang::driver::Tool::ConstructJob | ( | Compilation & | C,
|  | const JobAction & | JA,
|  | const InputInfo & | Output,
|  | const InputInfoList & | Inputs,
|  | const llvm::opt::ArgList & | TCArgs,
|  | const char * | LinkingOutput
| ) |  | const
| pure virtual

ConstructJob - Construct jobs to perform the action `JA`, writing to `Output` and with `Inputs`, and add the jobs to `C`.

Parameters

  TCArgs | - The argument list for this toolchain, with any tool chain specific translations applied.
  LinkingOutput | - If this output will eventually feed the linker, then this is the final output name of the linked image.

Implemented in clang::driver::tools::OffloadBundler, clang::driver::tools::ClangAs, clang::driver::tools::NVPTX::OpenMPLinker, clang::driver::tools::darwin::VerifyDebug, clang::driver::tools::NVPTX::Linker, clang::driver::tools::Clang, clang::driver::tools::darwin::Dsymutil, clang::driver::tools::NVPTX::Assembler, clang::driver::tools::darwin::Lipo, clang::driver::tools::gcc::Common, clang::driver::tools::darwin::Linker, clang::driver::tools::baremetal::Linker, clang::driver::tools::gnutools::Linker, clang::driver::tools::darwin::Assembler, clang::driver::tools::msp430::Linker, clang::driver::tools::Myriad::Linker, clang::driver::tools::gnutools::Assembler, clang::driver::tools::RISCV::Linker, clang::driver::tools::visualstudio::Compiler, clang::driver::tools::PS4cpu::Link, clang::driver::tools::hexagon::Linker, clang::driver::tools::ananas::Linker, clang::driver::tools::CrossWindows::Linker, clang::driver::tools::freebsd::Linker, clang::driver::tools::MinGW::Linker, clang::driver::tools::netbsd::Linker, clang::driver::tools::openbsd::Linker, clang::driver::tools::solaris::Linker, clang::driver::tools::dragonfly::Linker, clang::driver::tools::minix::Linker, clang::driver::tools::SHAVE::Assembler, clang::driver::tools::XCore::Linker, clang::driver::tools::AVR::Linker, clang::driver::tools::nacltools::Linker, clang::driver::tools::AMDGCN::Linker, clang::driver::tools::PS4cpu::Assemble, clang::driver::tools::visualstudio::Linker, clang::driver::tools::hexagon::Assembler, clang::driver::tools::ananas::Assembler, clang::driver::tools::cloudabi::Linker, clang::driver::tools::freebsd::Assembler, clang::driver::tools::MinGW::Assembler, clang::driver::tools::netbsd::Assembler, clang::driver::tools::openbsd::Assembler, clang::driver::tools::solaris::Assembler, clang::driver::tools::amdgpu::Linker, clang::driver::tools::CrossWindows::Assembler, clang::driver::tools::dragonfly::Assembler, clang::driver::tools::minix::Assembler, clang::driver::tools::SHAVE::Compiler, clang::driver::tools::XCore::Assembler, clang::driver::tools::fuchsia::Linker, clang::driver::tools::wasm::Linker, and clang::driver::tools::nacltools::AssemblerARM.

Referenced by clang::driver::Driver::BuildJobsForAction(), and ConstructJobMultipleOutputs().

## ◆ ConstructJobMultipleOutputs()

void Tool::ConstructJobMultipleOutputs | ( | Compilation & | C,
|  | const JobAction & | JA,
|  | const InputInfoList & | Outputs,
|  | const InputInfoList & | Inputs,
|  | const llvm::opt::ArgList & | TCArgs,
|  | const char * | LinkingOutput
| ) |  | const
| virtual

Construct jobs to perform the action `JA`, writing to the `Outputs` and with `Inputs`, and add the jobs to `C`.

The default implementation assumes a single output and is expected to be overloaded for the tools that support multiple inputs.

Parameters

  TCArgs | The argument list for this toolchain, with any tool chain specific translations applied.
  LinkingOutput | If this output will eventually feed the linker, then this is the final output name of the linked image.

Reimplemented in clang::driver::tools::OffloadBundler.

Definition at line 26 of file Tool.cpp.

References ConstructJob().

Referenced by clang::driver::Driver::BuildJobsForAction().

## ◆ getName()

const char* clang::driver::Tool::getName | ( |  | ) | const
| inline

Definition at line 80 of file Tool.h.

Referenced by clang::driver::Driver::BuildJobsForAction(), and clang::createInvocationFromCommandLine().

## ◆ getResponseFileEncoding()

llvm::sys::WindowsEncodingMethod clang::driver::Tool::getResponseFileEncoding | ( |  | ) | const
| inline

Returns which encoding the response file should use.

This is only relevant on Windows platforms where there are different encodings being accepted for different tools. On UNIX, UTF8 is universal.

Windows use cases: - GCC and Binutils on mingw only accept ANSI response files encoded with the system current code page.

- MSVC's CL.exe and LINK.exe accept UTF16 on Windows.
- Clang accepts both UTF8 and UTF16.

FIXME: When GNU tools learn how to parse UTF16 on Windows, we should always use UTF16 for Windows, which is the Windows official encoding for international characters.

Definition at line 108 of file Tool.h.

## ◆ getResponseFileFlag()

const char* clang::driver::Tool::getResponseFileFlag | ( |  | ) | const
| inline

Returns which prefix to use when passing the name of a response file as a parameter to this tool.

Definition at line 113 of file Tool.h.

Referenced by clang::driver::Command::printArg().

## ◆ getResponseFilesSupport()

ResponseFileSupport clang::driver::Tool::getResponseFilesSupport | ( |  | ) | const
| inline

Returns the level of support for response files of this tool, whether it accepts arguments to be passed via a file on disk.

Definition at line 93 of file Tool.h.

Referenced by clang::driver::Driver::generateCompilationDiagnostics(), and clang::driver::Command::printArg().

## ◆ getShortName()

const char* clang::driver::Tool::getShortName | ( |  | ) | const
| inline

Definition at line 82 of file Tool.h.

Referenced by clang::driver::tools::OffloadBundler::ConstructJob(), clang::driver::tools::OffloadBundler::ConstructJobMultipleOutputs(), and clang::driver::Driver::ExecuteCompilation().

## ◆ getToolChain()

const ToolChain& clang::driver::Tool::getToolChain | ( |  | ) | const
| inline

Definition at line 84 of file Tool.h.

Referenced by clang::driver::tools::ClangAs::AddMIPSTargetArgs(), clang::driver::tools::ClangAs::AddX86TargetArgs(), clang::driver::Driver::BuildJobsForAction(), ConstructGoldLinkJob(), clang::driver::tools::wasm::Linker::ConstructJob(), clang::driver::tools::ClangAs::ConstructJob(), clang::driver::tools::OffloadBundler::ConstructJob(), clang::driver::tools::OffloadBundler::ConstructJobMultipleOutputs(), ConstructPS4LinkJob(), clang::driver::FallbackCommand::Execute(), parseClangCLEHFlags(), and clang::driver::tools::Clang::~Clang().

## ◆ hasGoodDiagnostics()

virtual bool clang::driver::Tool::hasGoodDiagnostics | ( |  | ) | const
| inline virtual

Does this tool have "good" standardized diagnostics, or should the driver add an additional "command failed" diagnostic on failures.

Reimplemented in clang::driver::tools::ClangAs, clang::driver::tools::gcc::Compiler, clang::driver::tools::gcc::Preprocessor, and clang::driver::tools::Clang.

Definition at line 117 of file Tool.h.

Referenced by clang::driver::Driver::ExecuteCompilation().

## ◆ hasIntegratedAssembler()

virtual bool clang::driver::Tool::hasIntegratedAssembler | ( |  | ) | const
| inline virtual

Reimplemented in clang::driver::tools::ClangAs, clang::driver::tools::Clang, clang::driver::tools::gcc::Common, and clang::driver::tools::visualstudio::Compiler.

Definition at line 86 of file Tool.h.

Referenced by clang::driver::Driver::BuildJobs().

## ◆ hasIntegratedCPP()

virtual bool clang::driver::Tool::hasIntegratedCPP | ( |  | ) | const
| pure virtual

Implemented in clang::driver::tools::OffloadBundler, clang::driver::tools::gcc::Linker, clang::driver::tools::ClangAs, clang::driver::tools::NVPTX::OpenMPLinker, clang::driver::tools::darwin::VerifyDebug, clang::driver::tools::gcc::Compiler, clang::driver::tools::NVPTX::Linker, clang::driver::tools::Clang, clang::driver::tools::gcc::Preprocessor, clang::driver::tools::darwin::Dsymutil, clang::driver::tools::NVPTX::Assembler, clang::driver::tools::darwin::Lipo, clang::driver::tools::darwin::Linker, clang::driver::tools::baremetal::Linker, clang::driver::tools::gnutools::Linker, clang::driver::tools::darwin::Assembler, clang::driver::tools::msp430::Linker, clang::driver::tools::Myriad::Linker, clang::driver::tools::gnutools::Assembler, clang::driver::tools::RISCV::Linker, clang::driver::tools::visualstudio::Compiler, clang::driver::tools::PS4cpu::Link, clang::driver::tools::hexagon::Linker, clang::driver::tools::ananas::Linker, clang::driver::tools::CrossWindows::Linker, clang::driver::tools::freebsd::Linker, clang::driver::tools::MinGW::Linker, clang::driver::tools::netbsd::Linker, clang::driver::tools::openbsd::Linker, clang::driver::tools::solaris::Linker, clang::driver::tools::dragonfly::Linker, clang::driver::tools::minix::Linker, clang::driver::tools::SHAVE::Assembler, clang::driver::tools::XCore::Linker, clang::driver::tools::AVR::Linker, clang::driver::tools::nacltools::Linker, clang::driver::tools::AMDGCN::Linker, clang::driver::tools::PS4cpu::Assemble, clang::driver::tools::visualstudio::Linker, clang::driver::tools::hexagon::Assembler, clang::driver::tools::amdgpu::Linker, clang::driver::tools::ananas::Assembler, clang::driver::tools::freebsd::Assembler, clang::driver::tools::MinGW::Assembler, clang::driver::tools::netbsd::Assembler, clang::driver::tools::openbsd::Assembler, clang::driver::tools::solaris::Assembler, clang::driver::tools::XCore::Assembler, clang::driver::tools::cloudabi::Linker, clang::driver::tools::CrossWindows::Assembler, clang::driver::tools::dragonfly::Assembler, clang::driver::tools::minix::Assembler, clang::driver::tools::SHAVE::Compiler, clang::driver::tools::wasm::Linker, and clang::driver::tools::fuchsia::Linker.

Referenced by clang::driver::Driver::BuildJobs().

## ◆ isDsymutilJob()

virtual bool clang::driver::Tool::isDsymutilJob | ( |  | ) | const
| inline virtual

Reimplemented in clang::driver::tools::darwin::Dsymutil.

Definition at line 90 of file Tool.h.

Referenced by clang::driver::Driver::generateCompilationDiagnostics().

## ◆ isLinkJob()

virtual bool clang::driver::Tool::isLinkJob | ( |  | ) | const
| inline virtual

Reimplemented in clang::driver::tools::gcc::Linker, clang::driver::tools::darwin::Linker, clang::driver::tools::baremetal::Linker, clang::driver::tools::gnutools::Linker, clang::driver::tools::msp430::Linker, clang::driver::tools::Myriad::Linker, clang::driver::tools::RISCV::Linker, clang::driver::tools::visualstudio::Compiler, clang::driver::tools::PS4cpu::Link, clang::driver::tools::hexagon::Linker, clang::driver::tools::ananas::Linker, clang::driver::tools::CrossWindows::Linker, clang::driver::tools::freebsd::Linker, clang::driver::tools::MinGW::Linker, clang::driver::tools::netbsd::Linker, clang::driver::tools::openbsd::Linker, clang::driver::tools::solaris::Linker, clang::driver::tools::dragonfly::Linker, clang::driver::tools::minix::Linker, clang::driver::tools::XCore::Linker, clang::driver::tools::AVR::Linker, clang::driver::tools::nacltools::Linker, clang::driver::tools::visualstudio::Linker, clang::driver::tools::cloudabi::Linker, clang::driver::tools::amdgpu::Linker, clang::driver::tools::fuchsia::Linker, and clang::driver::tools::wasm::Linker.

Definition at line 89 of file Tool.h.

Referenced by clang::driver::Driver::generateCompilationDiagnostics().

The documentation for this class was generated from the following files:

- include/clang/Driver/Tool.h
- lib/Driver/Tool.cpp