class Command

Declaration

class Command { /* full declaration omitted */ };

Description

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

Declared at: clang/include/clang/Driver/Job.h:106

Member Variables

private const clang::driver::Action& Source
Source - The action which caused the creation of this job.
private const clang::driver::Tool& Creator
Tool - The tool which caused the creation of this job.
private clang::driver::ResponseFileSupport ResponseSupport
Whether and how to generate response files if the arguments are too long.
private const char* Executable
The executable to run.
private llvm::opt::ArgStringList Arguments
The list of program arguments (not including the implicit first argument, which will be the executable).
private std::vector<InputInfo> InputInfoList
The list of program inputs.
private std::vector<std::string> OutputFilenames
The list of program arguments which are outputs. May be empty.
private const char* ResponseFile = nullptr
Response file name, if this command is set to use one, or nullptr otherwise
private llvm::opt::ArgStringList InputFileList
The input file list in case we need to emit a file list instead of a proper response file
private std::string ResponseFileFlag
String storage if we need to create a new argument to specify a response file
private std::vector<const char*> Environment
See Command::setEnvironment
private Optional<llvm::sys::ProcessStatistics> ProcStat
Information on executable run provided by OS.
public bool PrintInputFilenames = false
Whether to print the input filenames when executing.
public bool InProcess = false
Whether the command will be executed in this process or not.

Method Overview

  • public Command(const clang::driver::Action & Source, const clang::driver::Tool & Creator, clang::driver::ResponseFileSupport ResponseSupport, const char * Executable, const llvm::opt::ArgStringList & Arguments, ArrayRef<clang::driver::InputInfo> Inputs, ArrayRef<clang::driver::InputInfo> Outputs = None)
  • public Command(const clang::driver::Command &)
  • public virtual int Execute(ArrayRef<Optional<llvm::StringRef>> Redirects, std::string * ErrMsg, bool * ExecutionFailed) const
  • public virtual void Print(llvm::raw_ostream & OS, const char * Terminator, bool Quote, clang::driver::CrashReportInfo * CrashInfo = nullptr) const
  • protected void PrintFileNames() const
  • private void buildArgvForResponseFile(llvm::SmallVectorImpl<const char *> & Out) const
  • public const llvm::opt::ArgStringList & getArguments() const
  • public const clang::driver::Tool & getCreator() const
  • public const char * getExecutable() const
  • public const std::vector<InputInfo> & getInputInfos() const
  • public const std::vector<std::string> & getOutputFilenames() const
  • public Optional<llvm::sys::ProcessStatistics> getProcessStatistics() const
  • public const clang::driver::ResponseFileSupport & getResponseFileSupport()
  • public const clang::driver::Action & getSource() const
  • public void replaceArguments(llvm::opt::ArgStringList List)
  • public void replaceExecutable(const char * Exe)
  • public virtual void setEnvironment(llvm::ArrayRef<const char *> NewEnvironment)
  • public void setInputFileList(llvm::opt::ArgStringList List)
  • public void setResponseFile(const char * FileName)
  • private void writeResponseFile(llvm::raw_ostream & OS) const
  • public virtual ~Command()

Methods

Command(const clang::driver::Action& Source,
        const clang::driver::Tool& Creator,
        clang::driver::ResponseFileSupport
            ResponseSupport,
        const char* Executable,
        const llvm::opt::ArgStringList& Arguments,
        ArrayRef<clang::driver::InputInfo> Inputs,
        ArrayRef<clang::driver::InputInfo>
            Outputs = None)

Declared at: clang/include/clang/Driver/Job.h:166

Parameters

const clang::driver::Action& Source
const clang::driver::Tool& Creator
clang::driver::ResponseFileSupport ResponseSupport
const char* Executable
const llvm::opt::ArgStringList& Arguments
ArrayRef<clang::driver::InputInfo> Inputs
ArrayRef<clang::driver::InputInfo> Outputs = None

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

Declared at: clang/include/clang/Driver/Job.h:172

Parameters

const clang::driver::Command&

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

Declared at: clang/include/clang/Driver/Job.h:178

Parameters

ArrayRef<Optional<llvm::StringRef>> Redirects
std::string* ErrMsg
bool* ExecutionFailed

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

Declared at: clang/include/clang/Driver/Job.h:175

Parameters

llvm::raw_ostream& OS
const char* Terminator
bool Quote
clang::driver::CrashReportInfo* CrashInfo = nullptr

void PrintFileNames() const

Description

Optionally print the filenames to be compiled

Declared at: clang/include/clang/Driver/Job.h:229

void buildArgvForResponseFile(
    llvm::SmallVectorImpl<const char*>& Out) const

Description

When a response file is needed, we try to put most arguments in an exclusive file, while others remains as regular command line arguments. This functions fills a vector with the regular command line arguments, argv, excluding the ones passed in a response file.

Declared at: clang/include/clang/Driver/Job.h:151

Parameters

llvm::SmallVectorImpl<const char*>& Out

const llvm::opt::ArgStringList& getArguments()
    const

Declared at: clang/include/clang/Driver/Job.h:215

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

Description

getCreator - Return the Tool which caused the creation of this job.

Declared at: clang/include/clang/Driver/Job.h:185

const char* getExecutable() const

Declared at: clang/include/clang/Driver/Job.h:213

const std::vector<InputInfo>& getInputInfos()
    const

Declared at: clang/include/clang/Driver/Job.h:217

const std::vector<std::string>&
getOutputFilenames() const

Declared at: clang/include/clang/Driver/Job.h:219

Optional<llvm::sys::ProcessStatistics>
getProcessStatistics() const

Declared at: clang/include/clang/Driver/Job.h:223

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

Description

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

Declared at: clang/include/clang/Driver/Job.h:188

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

Description

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

Declared at: clang/include/clang/Driver/Job.h:182

void replaceArguments(
    llvm::opt::ArgStringList List)

Declared at: clang/include/clang/Driver/Job.h:207

Parameters

llvm::opt::ArgStringList List

void replaceExecutable(const char* Exe)

Declared at: clang/include/clang/Driver/Job.h:211

Parameters

const char* Exe

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

Description

Sets the environment to be used by the new process.

Declared at: clang/include/clang/Driver/Job.h:205

Parameters

llvm::ArrayRef<const char*> NewEnvironment
An array of environment variables.

void setInputFileList(
    llvm::opt::ArgStringList List)

Description

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

Declared at: clang/include/clang/Driver/Job.h:197

Parameters

llvm::opt::ArgStringList List

void setResponseFile(const char* FileName)

Description

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

Declared at: clang/include/clang/Driver/Job.h:193

Parameters

const char* FileName

void writeResponseFile(
    llvm::raw_ostream& OS) const

Description

Encodes an array of C strings into a single string separated by whitespace. This function will also put in quotes arguments that have whitespaces and will escape the regular backslashes (used in Windows paths) and quotes. The results are the contents of a response file, written into a raw_ostream.

Declared at: clang/include/clang/Driver/Job.h:157

Parameters

llvm::raw_ostream& OS

virtual ~Command()

Declared at: clang/include/clang/Driver/Job.h:173