LLVM 22.0.0git
llvm::cl::ExpansionContext Class Reference

Contains options that control response file expansion. More...

#include "llvm/Support/CommandLine.h"

Public Member Functions

LLVM_ABI ExpansionContext (BumpPtrAllocator &A, TokenizerCallback T, vfs::FileSystem *FS=nullptr)
ExpansionContextsetMarkEOLs (bool X)
ExpansionContextsetRelativeNames (bool X)
ExpansionContextsetCurrentDir (StringRef X)
ExpansionContextsetSearchDirs (ArrayRef< StringRef > X)
ExpansionContextsetVFS (vfs::FileSystem *X)
LLVM_ABI bool findConfigFile (StringRef FileName, SmallVectorImpl< char > &FilePath)
 Looks for the specified configuration file.
LLVM_ABI Error readConfigFile (StringRef CfgFile, SmallVectorImpl< const char * > &Argv)
 Reads command line options from the given configuration file.
LLVM_ABI Error expandResponseFiles (SmallVectorImpl< const char * > &Argv)
 Expands constructs "@file" in the provided array of arguments recursively.

Detailed Description

Contains options that control response file expansion.

Definition at line 2164 of file CommandLine.h.

Constructor & Destructor Documentation

◆ ExpansionContext()

ExpansionContext::ExpansionContext ( BumpPtrAllocator & A,
TokenizerCallback T,
vfs::FileSystem * FS = nullptr )

Definition at line 1405 of file CommandLine.cpp.

References A(), llvm::get(), and T.

Referenced by setCurrentDir(), setMarkEOLs(), setRelativeNames(), setSearchDirs(), and setVFS().

Member Function Documentation

◆ expandResponseFiles()

◆ findConfigFile()

bool ExpansionContext::findConfigFile ( StringRef FileName,
SmallVectorImpl< char > & FilePath )

Looks for the specified configuration file.

Parameters
[in]FileNameName of the file to search for.
[out]FilePathFile absolute path, if it was found.
Returns
True if file was found.

If the specified file name contains a directory separator, it is searched for by its absolute path. Otherwise looks for file sequentially in directories specified by SearchDirs field.

Definition at line 1409 of file CommandLine.cpp.

References llvm::sys::path::append(), llvm::SmallString< InternalLen >::assign(), llvm::SmallVectorImpl< T >::assign(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::sys::path::has_parent_path(), llvm::sys::path::is_relative(), llvm::sys::path::native, and llvm::sys::fs::regular_file.

◆ readConfigFile()

Error ExpansionContext::readConfigFile ( StringRef CfgFile,
SmallVectorImpl< const char * > & Argv )

Reads command line options from the given configuration file.

Parameters
[in]CfgFilePath to configuration file.
[out]ArgvArray to which the read options are added.
Returns
true if the file was successfully read.

It reads content of the specified file, tokenizes it and expands "@file" commands resolving file names in them relative to the directory where CfgFilename resides. It also expands "<CFGDIR>" to the base path of the current config file.

Definition at line 1446 of file CommandLine.cpp.

References llvm::SmallString< InternalLen >::assign(), expandResponseFiles(), llvm::sys::path::is_relative(), llvm::make_error(), and llvm::SmallString< InternalLen >::str().

◆ setCurrentDir()

ExpansionContext & llvm::cl::ExpansionContext::setCurrentDir ( StringRef X)
inline

Definition at line 2209 of file CommandLine.h.

References ExpansionContext(), and X.

◆ setMarkEOLs()

ExpansionContext & llvm::cl::ExpansionContext::setMarkEOLs ( bool X)
inline

Definition at line 2199 of file CommandLine.h.

References ExpansionContext(), and X.

◆ setRelativeNames()

ExpansionContext & llvm::cl::ExpansionContext::setRelativeNames ( bool X)
inline

Definition at line 2204 of file CommandLine.h.

References ExpansionContext(), and X.

◆ setSearchDirs()

ExpansionContext & llvm::cl::ExpansionContext::setSearchDirs ( ArrayRef< StringRef > X)
inline

Definition at line 2214 of file CommandLine.h.

References ExpansionContext(), and X.

◆ setVFS()

ExpansionContext & llvm::cl::ExpansionContext::setVFS ( vfs::FileSystem * X)
inline

Definition at line 2219 of file CommandLine.h.

References ExpansionContext(), and X.


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