clang API Documentation

Public Types | Public Member Functions | Protected Member Functions
clang::driver::ArgList Class Reference

#include <ArgList.h>

Inheritance diagram for clang::driver::ArgList:
Inheritance graph
[legend]

List of all members.

Public Types

typedef SmallVector< Arg *, 16 > arglist_type
typedef arglist_type::iterator iterator
typedef
arglist_type::const_iterator 
const_iterator
typedef
arglist_type::reverse_iterator 
reverse_iterator
typedef
arglist_type::const_reverse_iterator 
const_reverse_iterator

Public Member Functions

virtual ~ArgList ()
Arg Access
void append (Arg *A)
 append - Append
arglist_typegetArgs ()
const arglist_typegetArgs () const
unsigned size () const
bool hasArgNoClaim (OptSpecifier Id) const
bool hasArg (OptSpecifier Id) const
bool hasArg (OptSpecifier Id0, OptSpecifier Id1) const
bool hasArg (OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2) const
ArggetLastArgNoClaim (OptSpecifier Id) const
ArggetLastArg (OptSpecifier Id) const
ArggetLastArg (OptSpecifier Id0, OptSpecifier Id1) const
ArggetLastArg (OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2) const
ArggetLastArg (OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2, OptSpecifier Id3) const
ArggetLastArg (OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2, OptSpecifier Id3, OptSpecifier Id4) const
virtual const char * getArgString (unsigned Index) const =0
 getArgString - Return the input argument string at
virtual unsigned getNumInputArgStrings () const =0
Arg Iteration
iterator begin ()
iterator end ()
reverse_iterator rbegin ()
reverse_iterator rend ()
const_iterator begin () const
const_iterator end () const
const_reverse_iterator rbegin () const
const_reverse_iterator rend () const
arg_iterator filtered_begin (OptSpecifier Id0=0U, OptSpecifier Id1=0U, OptSpecifier Id2=0U) const
arg_iterator filtered_end () const
Arg Removal
void eraseArg (OptSpecifier Id)
 eraseArg - Remove any option matching
Argument Lookup Utilities
StringRef getLastArgValue (OptSpecifier Id, StringRef Default="") const
 getLastArgValue - Return the value of the last argument, or a default.
int getLastArgIntValue (OptSpecifier Id, int Default, DiagnosticsEngine &Diags) const
std::vector< std::string > getAllArgValues (OptSpecifier Id) const
Translation Utilities
bool hasFlag (OptSpecifier Pos, OptSpecifier Neg, bool Default=true) const
void AddLastArg (ArgStringList &Output, OptSpecifier Id0) const
void AddAllArgs (ArgStringList &Output, OptSpecifier Id0, OptSpecifier Id1=0U, OptSpecifier Id2=0U) const
 AddAllArgs - Render all arguments matching the given ids.
void AddAllArgValues (ArgStringList &Output, OptSpecifier Id0, OptSpecifier Id1=0U, OptSpecifier Id2=0U) const
void AddAllArgsTranslated (ArgStringList &Output, OptSpecifier Id0, const char *Translation, bool Joined=false) const
void ClaimAllArgs (OptSpecifier Id0) const
void ClaimAllArgs () const
Arg Synthesis
virtual const char * MakeArgString (StringRef Str) const =0
const char * MakeArgString (const char *Str) const
const char * MakeArgString (std::string Str) const
const char * MakeArgString (const Twine &Str) const
const char * GetOrMakeJoinedArgString (unsigned Index, StringRef LHS, StringRef RHS) const
 Create an arg string for (.

Protected Member Functions

 ArgList ()

Detailed Description

ArgList - Ordered collection of driver arguments.

The ArgList class manages a list of Arg instances as well as auxiliary data and convenience methods to allow Tools to quickly check for the presence of Arg instances for a particular Option and to iterate over groups of arguments.

Definition at line 95 of file ArgList.h.


Member Typedef Documentation

typedef SmallVector<Arg*, 16> clang::driver::ArgList::arglist_type

Definition at line 101 of file ArgList.h.

typedef arglist_type::const_iterator clang::driver::ArgList::const_iterator

Definition at line 103 of file ArgList.h.

typedef arglist_type::const_reverse_iterator clang::driver::ArgList::const_reverse_iterator

Definition at line 105 of file ArgList.h.

typedef arglist_type::iterator clang::driver::ArgList::iterator

Definition at line 102 of file ArgList.h.

typedef arglist_type::reverse_iterator clang::driver::ArgList::reverse_iterator

Definition at line 104 of file ArgList.h.


Constructor & Destructor Documentation

ArgList::ArgList ( ) [protected]

Definition at line 39 of file ArgList.cpp.

ArgList::~ArgList ( ) [virtual]

Definition at line 42 of file ArgList.cpp.


Member Function Documentation

void ArgList::AddAllArgs ( ArgStringList Output,
OptSpecifier  Id0,
OptSpecifier  Id1 = 0U,
OptSpecifier  Id2 = 0U 
) const
void ArgList::AddAllArgsTranslated ( ArgStringList Output,
OptSpecifier  Id0,
const char *  Translation,
bool  Joined = false 
) const

AddAllArgsTranslated - Render all the arguments matching the given ids, but forced to separate args and using the provided name instead of the first option value.

Parameters:
Joined- If true, render the argument as joined with the option specifier.

Definition at line 201 of file ArgList.cpp.

Referenced by clang::driver::tools::darwin::CC1::AddCC1OptionsArgs(), clang::driver::tools::darwin::CC1::AddCPPOptionsArgs(), and clang::driver::tools::Clang::ConstructJob().

void ArgList::AddAllArgValues ( ArgStringList Output,
OptSpecifier  Id0,
OptSpecifier  Id1 = 0U,
OptSpecifier  Id2 = 0U 
) const
void ArgList::AddLastArg ( ArgStringList Output,
OptSpecifier  Id0 
) const
void ArgList::append ( Arg A)
iterator clang::driver::ArgList::begin ( ) [inline]
const_iterator clang::driver::ArgList::begin ( ) const [inline]

Definition at line 138 of file ArgList.h.

void ArgList::ClaimAllArgs ( OptSpecifier  Id0) const
void ArgList::ClaimAllArgs ( ) const

ClaimAllArgs - Claim all arguments.

Definition at line 224 of file ArgList.cpp.

iterator clang::driver::ArgList::end ( ) [inline]
const_iterator clang::driver::ArgList::end ( ) const [inline]

Definition at line 139 of file ArgList.h.

void ArgList::eraseArg ( OptSpecifier  Id)

eraseArg - Remove any option matching

  • Id.

Definition at line 49 of file ArgList.cpp.

References Args.

Referenced by clang::driver::Compilation::initCompilationForDiagnostics().

arg_iterator clang::driver::ArgList::filtered_begin ( OptSpecifier  Id0 = 0U,
OptSpecifier  Id1 = 0U,
OptSpecifier  Id2 = 0U 
) const [inline]
arg_iterator clang::driver::ArgList::filtered_end ( ) const [inline]
std::vector< std::string > ArgList::getAllArgValues ( OptSpecifier  Id) const

getAllArgValues - Get the values of all instances of the given argument as strings.

Definition at line 169 of file ArgList.cpp.

Referenced by ParseCodeGenArgs(), ParseDependencyOutputArgs(), ParseDiagnosticArgs(), ParseFrontendArgs(), ParsePreprocessorArgs(), and ParseTargetArgs().

arglist_type& clang::driver::ArgList::getArgs ( ) [inline]

Definition at line 123 of file ArgList.h.

const arglist_type& clang::driver::ArgList::getArgs ( ) const [inline]

Definition at line 124 of file ArgList.h.

virtual const char* clang::driver::ArgList::getArgString ( unsigned  Index) const [pure virtual]
Arg * ArgList::getLastArg ( OptSpecifier  Id) const

Definition at line 68 of file ArgList.cpp.

References clang::driver::Arg::claim().

Referenced by clang::driver::tools::darwin::CC1::AddCC1OptionsArgs(), clang::driver::tools::darwin::CC1::AddCPPOptionsArgs(), clang::driver::tools::darwin::CC1::AddCPPUniqueOptionsArgs(), clang::driver::toolchains::DarwinClang::AddCXXStdlibLibArgs(), addExceptionArgs(), clang::driver::toolchains::DarwinClang::AddLinkRuntimeLibArgs(), clang::driver::Driver::BuildActions(), clang::driver::Driver::BuildCompilation(), clang::driver::Driver::BuildInputs(), clang::driver::Driver::BuildJobs(), clang::driver::Driver::BuildUniversalActions(), CheckCodeGenerationOptions(), CheckPreprocessingOptions(), clang::driver::ToolChain::ComputeEffectiveClangTriple(), computeTargetTriple(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::ClangAs::ConstructJob(), clang::driver::tools::darwin::Compile::ConstructJob(), clang::driver::tools::linuxtools::Assemble::ConstructJob(), getARMTargetCPU(), clang::driver::ToolChain::GetCXXStdlibType(), clang::driver::toolchains::Darwin::getDarwinArchName(), clang::driver::tools::darwin::CC1::getDependencyFileName(), clang::driver::Driver::GetNamedOutputPath(), clang::driver::ToolChain::GetRuntimeLibType(), clang::driver::Driver::HandleImmediateArgs(), hasArg(), clang::driver::Driver::IsUsingLTO(), ParseAnalyzerArgs(), ParseCodeGenArgs(), ParseDiagnosticArgs(), ParseFrontendArgs(), ParseHeaderSearchArgs(), ParseLangArgs(), ParsePreprocessorArgs(), clang::driver::toolchains::Darwin::SelectTool(), shouldUseFramePointer(), and UseRelaxAll().

Arg * ArgList::getLastArg ( OptSpecifier  Id0,
OptSpecifier  Id1 
) const

Definition at line 80 of file ArgList.cpp.

References clang::driver::Arg::claim().

Arg * ArgList::getLastArg ( OptSpecifier  Id0,
OptSpecifier  Id1,
OptSpecifier  Id2 
) const

Definition at line 94 of file ArgList.cpp.

References clang::driver::Arg::claim().

Arg * ArgList::getLastArg ( OptSpecifier  Id0,
OptSpecifier  Id1,
OptSpecifier  Id2,
OptSpecifier  Id3 
) const

Definition at line 109 of file ArgList.cpp.

References clang::driver::Arg::claim().

Arg * ArgList::getLastArg ( OptSpecifier  Id0,
OptSpecifier  Id1,
OptSpecifier  Id2,
OptSpecifier  Id3,
OptSpecifier  Id4 
) const

Definition at line 125 of file ArgList.cpp.

References clang::driver::Arg::claim().

int ArgList::getLastArgIntValue ( OptSpecifier  Id,
int  Default,
clang::DiagnosticsEngine Diags 
) const

getLastArgValue - Return the value of the last argument as an integer, or a default. Emits an error if the argument is given, but non-integral.

Definition at line 156 of file ArgList.cpp.

References clang::DiagnosticsEngine::Report().

Referenced by getOptimizationLevel(), ParseAnalyzerArgs(), ParseCodeGenArgs(), ParseDiagnosticArgs(), and ParseLangArgs().

Arg * ArgList::getLastArgNoClaim ( OptSpecifier  Id) const

getLastArg - Return the last argument matching

  • Id, or null.
  • Claim Whether the argument should be claimed, if it exists.

Definition at line 60 of file ArgList.cpp.

Referenced by hasArgNoClaim().

StringRef ArgList::getLastArgValue ( OptSpecifier  Id,
StringRef  Default = "" 
) const
virtual unsigned clang::driver::ArgList::getNumInputArgStrings ( ) const [pure virtual]

getNumInputArgStrings - Return the number of original argument strings, which are guaranteed to be the first strings in the argument string list.

Implemented in clang::driver::DerivedArgList, and clang::driver::InputArgList.

Referenced by clang::driver::SeparateOption::accept(), clang::driver::MultiArgOption::accept(), clang::driver::JoinedOrSeparateOption::accept(), and clang::driver::JoinedAndSeparateOption::accept().

const char * ArgList::GetOrMakeJoinedArgString ( unsigned  Index,
StringRef  LHS,
StringRef  RHS 
) const

Create an arg string for (.

  • LHS +
  • RHS), reusing the string at
  • Index if possible.

Definition at line 236 of file ArgList.cpp.

Referenced by clang::driver::Arg::render().

bool clang::driver::ArgList::hasArg ( OptSpecifier  Id) const [inline]

Definition at line 169 of file ArgList.h.

References getLastArg().

Referenced by addAsanRTLinux(), clang::driver::tools::darwin::CC1::AddCC1Args(), clang::driver::tools::darwin::CC1::AddCC1OptionsArgs(), clang::driver::toolchains::Linux::AddClangCXXStdlibIncludeArgs(), clang::driver::toolchains::Linux::AddClangSystemIncludeArgs(), clang::driver::toolchains::Windows::AddClangSystemIncludeArgs(), clang::driver::tools::darwin::CC1::AddCPPArgs(), clang::driver::tools::darwin::CC1::AddCPPOptionsArgs(), clang::driver::tools::darwin::CC1::AddCPPUniqueOptionsArgs(), AddLibgcc(), clang::driver::toolchains::DarwinClang::AddLinkRuntimeLibArgs(), addProfileRT(), clang::driver::Driver::BuildActions(), clang::driver::Driver::BuildCompilation(), clang::driver::Driver::BuildInputs(), clang::driver::Driver::BuildJobs(), clang::driver::Driver::BuildUniversalActions(), CheckCodeGenerationOptions(), CheckPreprocessingOptions(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::ClangAs::ConstructJob(), clang::driver::tools::darwin::Preprocess::ConstructJob(), clang::driver::tools::darwin::Compile::ConstructJob(), clang::driver::tools::darwin::Assemble::ConstructJob(), clang::driver::tools::darwin::Link::ConstructJob(), clang::driver::tools::openbsd::Link::ConstructJob(), clang::driver::tools::freebsd::Link::ConstructJob(), clang::driver::tools::netbsd::Link::ConstructJob(), clang::driver::tools::linuxtools::Link::ConstructJob(), clang::driver::tools::minix::Link::ConstructJob(), clang::driver::tools::auroraux::Link::ConstructJob(), clang::driver::tools::dragonfly::Link::ConstructJob(), clang::driver::tools::visualstudio::Link::ConstructJob(), clang::driver::Driver::ConstructPhaseAction(), clang::driver::Driver::ExecuteCompilation(), clang::driver::Driver::generateCompilationDiagnostics(), clang::driver::Driver::GetNamedOutputPath(), getOptimizationLevel(), clang::driver::Driver::HandleImmediateArgs(), clang::driver::Compilation::initCompilationForDiagnostics(), clang::driver::Driver::IsUsingLTO(), ParseAnalyzerArgs(), ParseCodeGenArgs(), ParseDependencyOutputArgs(), ParseDiagnosticArgs(), ParseFrontendArgs(), ParseHeaderSearchArgs(), ParseLangArgs(), ParseMigratorArgs(), ParsePreprocessorArgs(), ParsePreprocessorOutputArgs(), and SelectToolForJob().

bool clang::driver::ArgList::hasArg ( OptSpecifier  Id0,
OptSpecifier  Id1 
) const [inline]

Definition at line 172 of file ArgList.h.

References getLastArg().

bool clang::driver::ArgList::hasArg ( OptSpecifier  Id0,
OptSpecifier  Id1,
OptSpecifier  Id2 
) const [inline]

Definition at line 175 of file ArgList.h.

References getLastArg().

bool clang::driver::ArgList::hasArgNoClaim ( OptSpecifier  Id) const [inline]

hasArg - Does the arg list contain any option matching

  • Id.
  • Claim Whether the argument should be claimed, if it exists.

Definition at line 166 of file ArgList.h.

References getLastArgNoClaim().

Referenced by clang::driver::Driver::BuildInputs(), and clang::driver::toolchains::Darwin::TranslateArgs().

bool ArgList::hasFlag ( OptSpecifier  Pos,
OptSpecifier  Neg,
bool  Default = true 
) const
virtual const char* clang::driver::ArgList::MakeArgString ( StringRef  Str) const [pure virtual]

MakeArgString - Construct a constant string pointer whose lifetime will match that of the ArgList.

Implemented in clang::driver::DerivedArgList, and clang::driver::InputArgList.

Referenced by addAsanRTLinux(), clang::driver::toolchains::DarwinClang::AddCCKextLibArgs(), clang::driver::toolchains::DarwinClang::AddCXXStdlibLibArgs(), clang::driver::tools::darwin::DarwinTool::AddDarwinArch(), clang::driver::ToolChain::addExternCSystemInclude(), AddIncludeDirectoryList(), clang::driver::toolchains::DarwinClang::AddLinkARCArgs(), clang::driver::toolchains::DarwinClang::AddLinkRuntimeLib(), clang::driver::toolchains::DarwinClang::AddLinkSearchPathArgs(), addProfileRT(), clang::driver::ToolChain::addSystemInclude(), clang::driver::ToolChain::addSystemIncludes(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::ClangAs::ConstructJob(), clang::driver::tools::gcc::Common::ConstructJob(), clang::driver::tools::hexagon::Assemble::ConstructJob(), clang::driver::tools::hexagon::Link::ConstructJob(), clang::driver::tools::darwin::Preprocess::ConstructJob(), clang::driver::tools::darwin::Compile::ConstructJob(), clang::driver::tools::darwin::Assemble::ConstructJob(), clang::driver::tools::darwin::Link::ConstructJob(), clang::driver::tools::darwin::Lipo::ConstructJob(), clang::driver::tools::darwin::Dsymutil::ConstructJob(), clang::driver::tools::darwin::VerifyDebug::ConstructJob(), clang::driver::tools::openbsd::Assemble::ConstructJob(), clang::driver::tools::openbsd::Link::ConstructJob(), clang::driver::tools::freebsd::Assemble::ConstructJob(), clang::driver::tools::freebsd::Link::ConstructJob(), clang::driver::tools::netbsd::Assemble::ConstructJob(), clang::driver::tools::netbsd::Link::ConstructJob(), clang::driver::tools::linuxtools::Assemble::ConstructJob(), clang::driver::tools::linuxtools::Link::ConstructJob(), clang::driver::tools::minix::Assemble::ConstructJob(), clang::driver::tools::minix::Link::ConstructJob(), clang::driver::tools::auroraux::Assemble::ConstructJob(), clang::driver::tools::auroraux::Link::ConstructJob(), clang::driver::tools::dragonfly::Assemble::ConstructJob(), clang::driver::tools::dragonfly::Link::ConstructJob(), clang::driver::tools::visualstudio::Link::ConstructJob(), clang::driver::tools::darwin::CC1::getBaseInputName(), clang::driver::tools::darwin::CC1::getBaseInputStem(), clang::driver::tools::darwin::CC1::getDependencyFileName(), MakeArgString(), and clang::driver::Arg::render().

const char* clang::driver::ArgList::MakeArgString ( const char *  Str) const [inline]

Definition at line 265 of file ArgList.h.

References MakeArgString().

const char* clang::driver::ArgList::MakeArgString ( std::string  Str) const [inline]

Definition at line 268 of file ArgList.h.

References MakeArgString().

const char * ArgList::MakeArgString ( const Twine &  Str) const

Definition at line 230 of file ArgList.cpp.

reverse_iterator clang::driver::ArgList::rbegin ( ) [inline]

Definition at line 135 of file ArgList.h.

const_reverse_iterator clang::driver::ArgList::rbegin ( ) const [inline]

Definition at line 141 of file ArgList.h.

reverse_iterator clang::driver::ArgList::rend ( ) [inline]

Definition at line 136 of file ArgList.h.

const_reverse_iterator clang::driver::ArgList::rend ( ) const [inline]

Definition at line 142 of file ArgList.h.

unsigned clang::driver::ArgList::size ( ) const [inline]

Definition at line 126 of file ArgList.h.


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