clang  10.0.0git
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
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]
Collaboration diagram for clang::driver::Command:
[legend]

Public Member Functions

 Command (const Action &Source, const Tool &Creator, const char *Executable, const llvm::opt::ArgStringList &Arguments, ArrayRef< InputInfo > Inputs)
 
 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< Optional< StringRef >> Redirects, std::string *ErrMsg, bool *ExecutionFailed) const
 
const ActiongetSource () const
 getSource - Return the Action which caused the creation of this job. More...
 
const ToolgetCreator () const
 getCreator - Return the Tool which caused the creation of this job. More...
 
void setResponseFile (const char *FileName)
 Set to pass arguments via a response file when launching the command. More...
 
void setInputFileList (llvm::opt::ArgStringList List)
 Set an input file list, necessary if we need to use a response file but the tool being called only supports input files lists. More...
 
virtual void setEnvironment (llvm::ArrayRef< const char *> NewEnvironment)
 Sets the environment to be used by the new process. More...
 
const char * getExecutable () const
 
const llvm::opt::ArgStringList & getArguments () const
 

Static Public Member Functions

static void printArg (llvm::raw_ostream &OS, StringRef Arg, bool Quote)
 Print a command argument, and optionally quote it. More...
 

Public Attributes

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

Protected Member Functions

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

Detailed Description

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

Definition at line 41 of file Job.h.

Constructor & Destructor Documentation

◆ Command() [1/2]

Command::Command ( const Action Source,
const Tool Creator,
const char *  Executable,
const llvm::opt::ArgStringList &  Arguments,
ArrayRef< InputInfo Inputs 
)

Definition at line 38 of file Job.cpp.

◆ Command() [2/2]

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

◆ ~Command()

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

Member Function Documentation

◆ Execute()

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

◆ getArguments()

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

◆ getCreator()

const Tool& clang::driver::Command::getCreator ( ) const
inline

◆ getExecutable()

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

◆ getSource()

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

getSource - Return the Action which caused the creation of this job.

Definition at line 107 of file Job.h.

Referenced by clang::driver::Driver::ExecuteCompilation(), and InputsOk().

◆ Print()

void Command::Print ( llvm::raw_ostream &  OS,
const char *  Terminator,
bool  Quote,
CrashReportInfo CrashInfo = nullptr 
) const
virtual

◆ printArg()

void Command::printArg ( llvm::raw_ostream &  OS,
StringRef  Arg,
bool  Quote 
)
static

Print a command argument, and optionally quote it.

Definition at line 103 of file Job.cpp.

References clang::driver::Tool::getResponseFileFlag(), clang::driver::Tool::getResponseFilesSupport(), and clang::driver::Tool::RF_FileList.

Referenced by Print(), and printArgList().

◆ PrintFileNames()

void Command::PrintFileNames ( ) const
protected

Optionally print the filenames to be compiled.

Definition at line 318 of file Job.cpp.

References PrintInputFilenames.

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

◆ 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 312 of file Job.cpp.

◆ setInputFileList()

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

Set an input file list, necessary if we need to use a response file but the tool being called only supports input files lists.

Definition at line 117 of file Job.h.

◆ setResponseFile()

void Command::setResponseFile ( const char *  FileName)

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

Definition at line 306 of file Job.cpp.

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

Member Data Documentation

◆ InProcess

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

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

Definition at line 90 of file Job.h.

Referenced by 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 87 of file Job.h.

Referenced by PrintFileNames().


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