clang 24.0.0git
clang::driver::Command Class Reference

Command - An executable path/name and argument vector to execute. More...

#include "clang/Driver/Job.h"

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

Public Member Functions

 Command (const Action &Source, const Tool &Creator, ResponseFileSupport ResponseSupport, const char *Executable, const llvm::opt::ArgStringList &Arguments, ArrayRef< InputInfo > Inputs, ArrayRef< InputInfo > Outputs={}, const char *PrependArg=nullptr)
 Command (const Command &)=default
virtual ~Command ()=default
virtual void Print (llvm::raw_ostream &OS, const char *Terminator, bool Quote, CrashReportInfo *CrashInfo=nullptr) const
virtual int Execute (ArrayRef< std::optional< StringRef > > Redirects, std::string *ErrMsg, bool *ExecutionFailed) const
const ActiongetSource () const
 getSource - Return the Action which caused the creation of this job.
const ToolgetCreator () const
 getCreator - Return the Tool which caused the creation of this job.
BoundArch getBoundArch () const
 Return the bound architecture for this command, if any.
void setBoundArch (BoundArch BA)
StringRef getOffloadDeviceParallelJobGroup () const
void setOffloadDeviceParallelJobGroup (StringRef Group)
const ResponseFileSupportgetResponseFileSupport ()
 Returns the kind of response file supported by the current invocation.
void setResponseFile (const char *FileName)
 Set to pass arguments via a response file when launching the command.
void setInputFileList (llvm::opt::ArgStringList List)
 Set an input file list, necessary if you specified an RF_FileList response file support.
virtual void setEnvironment (llvm::ArrayRef< const char * > NewEnvironment)
 Sets the environment to be used by the new process.
void setRedirectFiles (const std::vector< std::optional< std::string > > &Redirects)
void replaceArguments (llvm::opt::ArgStringList List)
void replaceExecutable (const char *Exe)
const char * getExecutable () const
const llvm::opt::ArgStringList & getArguments () const
const std::vector< InputInfo > & getInputInfos () const
const std::vector< std::string > & getOutputFilenames () const
std::optional< llvm::sys::ProcessStatistics > getProcessStatistics () const

Public Attributes

bool PrintInputFilenames = false
 Whether to print the input filenames when executing.
bool InProcess = false
 Whether the command will be executed in this process or not.

Protected Member Functions

void PrintFileNames () const
 Optionally print the filenames to be compiled.

Detailed Description

Command - An executable path/name and argument vector to execute.

Definition at line 107 of file Job.h.

Constructor & Destructor Documentation

◆ Command() [1/2]

Command::Command ( const Action & Source,
const Tool & Creator,
ResponseFileSupport ResponseSupport,
const char * Executable,
const llvm::opt::ArgStringList & Arguments,
ArrayRef< InputInfo > Inputs,
ArrayRef< InputInfo > Outputs = {},
const char * PrependArg = nullptr )

Definition at line 38 of file Job.cpp.

References clang::for().

Referenced by clang::driver::CC1Command::CC1Command(), and Command().

◆ Command() [2/2]

clang::driver::Command::Command ( const Command & )
default

References Command().

◆ ~Command()

virtual clang::driver::Command::~Command ( )
virtualdefault

Member Function Documentation

◆ Execute()

int Command::Execute ( ArrayRef< std::optional< StringRef > > Redirects,
std::string * ErrMsg,
bool * ExecutionFailed ) const
virtual

◆ getArguments()

const llvm::opt::ArgStringList & clang::driver::Command::getArguments ( ) const
inline

◆ getBoundArch()

BoundArch clang::driver::Command::getBoundArch ( ) const
inline

Return the bound architecture for this command, if any.

Definition at line 202 of file Job.h.

Referenced by CanRunInParallelOffloadJobGroup(), clang::driver::Driver::generateCompilationDiagnostics(), HasDistinctBoundArch(), and isOffloadDeviceCC1JobCandidate().

◆ getCreator()

◆ getExecutable()

const char * clang::driver::Command::getExecutable ( ) const
inline

◆ getInputInfos()

const std::vector< InputInfo > & clang::driver::Command::getInputInfos ( ) const
inline

◆ getOffloadDeviceParallelJobGroup()

StringRef clang::driver::Command::getOffloadDeviceParallelJobGroup ( ) const
inline

Definition at line 205 of file Job.h.

Referenced by CanRunInParallelOffloadJobGroup(), and SameParallelOffloadJobGroup().

◆ getOutputFilenames()

const std::vector< std::string > & clang::driver::Command::getOutputFilenames ( ) const
inline

Definition at line 247 of file Job.h.

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

◆ getProcessStatistics()

std::optional< llvm::sys::ProcessStatistics > clang::driver::Command::getProcessStatistics ( ) const
inline

Definition at line 251 of file Job.h.

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

◆ getResponseFileSupport()

const ResponseFileSupport & clang::driver::Command::getResponseFileSupport ( )
inline

Returns the kind of response file supported by the current invocation.

Definition at line 213 of file Job.h.

◆ getSource()

const Action & clang::driver::Command::getSource ( ) const
inline

◆ Print()

◆ PrintFileNames()

void Command::PrintFileNames ( ) const
protected

Optionally print the filenames to be compiled.

Definition at line 317 of file Job.cpp.

References PrintInputFilenames.

Referenced by clang::driver::CC1Command::Execute(), and Execute().

◆ replaceArguments()

void clang::driver::Command::replaceArguments ( llvm::opt::ArgStringList List)
inline

Definition at line 235 of file Job.h.

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

◆ replaceExecutable()

void clang::driver::Command::replaceExecutable ( const char * Exe)
inline

Definition at line 239 of file Job.h.

◆ setBoundArch()

void clang::driver::Command::setBoundArch ( BoundArch BA)
inline

Definition at line 203 of file Job.h.

References clang::BoundArch::ArchName.

Referenced by isOffloadDeviceCC1JobCandidate().

◆ setEnvironment()

void Command::setEnvironment ( llvm::ArrayRef< const char * > NewEnvironment)
virtual

Sets the environment to be used by the new process.

Parameters
NewEnvironmentAn array of environment variables.
Remarks
If the environment remains unset, then the environment from the parent process will be used.

Reimplemented in clang::driver::CC1Command.

Definition at line 306 of file Job.cpp.

◆ setInputFileList()

void clang::driver::Command::setInputFileList ( llvm::opt::ArgStringList List)
inline

Set an input file list, necessary if you specified an RF_FileList response file support.

Definition at line 222 of file Job.h.

◆ setOffloadDeviceParallelJobGroup()

void clang::driver::Command::setOffloadDeviceParallelJobGroup ( StringRef Group)
inline

Definition at line 208 of file Job.h.

◆ setRedirectFiles()

void Command::setRedirectFiles ( const std::vector< std::optional< std::string > > & Redirects)

Definition at line 312 of file Job.cpp.

◆ setResponseFile()

void Command::setResponseFile ( const char * FileName)

Set to pass arguments via a response file when launching the command.

Definition at line 300 of file Job.cpp.

References clang::FileName.

Member Data Documentation

◆ InProcess

bool clang::driver::Command::InProcess = false

Whether the command will be executed in this process or not.

Definition at line 178 of file Job.h.

Referenced by CanRunInParallelOffloadJobGroup(), clang::driver::CC1Command::CC1Command(), clang::driver::CC1Command::Execute(), and clang::driver::CC1Command::Print().

◆ PrintInputFilenames

bool clang::driver::Command::PrintInputFilenames = false

Whether to print the input filenames when executing.

Definition at line 175 of file Job.h.

Referenced by CanRunInParallelOffloadJobGroup(), and PrintFileNames().


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