LLVM API Documentation
#include "llvm/Support/CommandLine.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Config/config.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/system_error.h"
#include <cerrno>
#include <cstdlib>
#include <map>
Go to the source code of this file.
Namespaces | |
llvm | |
List of target independent CodeGen pass IDs. | |
llvm::cl | |
Macros | |
#define | PRINT_OPT_DIFF(T) |
Typedefs | |
typedef SmallPtrSet < OptionCategory *, 16 > | OptionCatSet |
Variables | |
static char | ProgramName [80] = "<premain>" |
static const char * | ProgramOverview = 0 |
static ManagedStatic < std::vector< const char * > > | MoreHelp |
static bool | OptionListChanged = false |
static Option * | RegisteredOptionList = 0 |
static ManagedStatic < OptionCatSet > | RegisteredOptionCategories |
static const size_t | MaxOptWidth = 8 |
static cl::opt< HelpPrinter, true, parser< bool > > | HLOp ("help-list", cl::desc("Display list of available options (-help-list-hidden for more)"), cl::location(UncategorizedNormalPrinter), cl::Hidden, cl::ValueDisallowed) |
static cl::opt< HelpPrinter, true, parser< bool > > | HLHOp ("help-list-hidden", cl::desc("Display list of all available options"), cl::location(UncategorizedHiddenPrinter), cl::Hidden, cl::ValueDisallowed) |
static cl::opt < HelpPrinterWrapper, true, parser< bool > > | HOp ("help", cl::desc("Display available options (-help-hidden for more)"), cl::location(WrappedNormalPrinter), cl::ValueDisallowed) |
static cl::opt < HelpPrinterWrapper, true, parser< bool > > | HHOp ("help-hidden", cl::desc("Display all available options"), cl::location(WrappedHiddenPrinter), cl::Hidden, cl::ValueDisallowed) |
static cl::opt< bool > | PrintOptions ("print-options", cl::desc("Print non-default options after command line parsing"), cl::Hidden, cl::init(false)) |
static cl::opt< bool > | PrintAllOptions ("print-all-options", cl::desc("Print all option values after command line parsing"), cl::Hidden, cl::init(false)) |
static void(* | OverrideVersionPrinter )()=0 |
static std::vector< void(*)()> * | ExtraVersionPrinters = 0 |
static VersionPrinter | VersionPrinterInstance |
static cl::opt< VersionPrinter, true, parser< bool > > | VersOp ("version", cl::desc("Display the version of this program"), cl::location(VersionPrinterInstance), cl::ValueDisallowed) |
#define PRINT_OPT_DIFF | ( | T | ) |
Definition at line 1321 of file CommandLine.cpp.
typedef SmallPtrSet<OptionCategory*,16> OptionCatSet |
Definition at line 115 of file CommandLine.cpp.
|
static |
Referenced by llvm::cl::PrintHelpMessage().
|
static |
Referenced by llvm::cl::PrintHelpMessage().
|
static |
CommaSeparateAndAddOccurence - A wrapper around Handler->addOccurence() that does special handling of cl::CommaSeparated options.
Definition at line 251 of file CommandLine.cpp.
References llvm::cl::Option::addOccurrence(), llvm::cl::CommaSeparated, llvm::StringRef::find(), llvm::cl::Option::getMiscFlags(), llvm::StringRef::npos, and llvm::StringRef::substr().
Referenced by ProvideOption().
Definition at line 437 of file CommandLine.cpp.
References llvm::cl::Option::getNumOccurrencesFlag(), llvm::cl::OneOrMore, and llvm::cl::ZeroOrMore.
Referenced by llvm::cl::ParseCommandLineOptions().
|
static |
Definition at line 609 of file CommandLine.cpp.
References llvm::convertUTF16ToUTF8String(), llvm::MemoryBuffer::getBufferEnd(), llvm::MemoryBuffer::getBufferSize(), llvm::MemoryBuffer::getBufferStart(), llvm::MemoryBuffer::getFile(), and llvm::hasUTF16ByteOrderMark().
Referenced by llvm::cl::ExpandResponseFiles().
|
static |
GetOptionInfo - Scan the list of registered options, turning them into data structures that are easier to handle.
Definition at line 132 of file CommandLine.cpp.
References llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorImpl< T >::clear(), llvm::cl::ConsumeAfter, llvm::SmallVectorTemplateCommon< T >::end(), llvm::errs(), llvm::cl::Option::getExtraOptionNames(), llvm::cl::Option::getNextRegisteredOption(), llvm::StringMap< ValueTy, AllocatorTy >::GetOrCreateValue(), llvm::cl::Positional, ProgramName, llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), RegisteredOptionList, llvm::StringMapEntry< ValueTy >::second, llvm::cl::Sink, and llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by llvm::cl::getRegisteredOptions(), llvm::cl::ParseCommandLineOptions(), and llvm::cl::PrintOptionValues().
|
static |
Definition at line 360 of file CommandLine.cpp.
References llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::StringMap< ValueTy, AllocatorTy >::find(), llvm::StringMapEntry< ValueTy >::second, llvm::StringRef::size(), and llvm::StringRef::substr().
Referenced by HandlePrefixedOrGroupedOption().
|
static |
Definition at line 1070 of file CommandLine.cpp.
References llvm::cl::Option::ValueStr.
Referenced by llvm::cl::basic_parser_impl::getOptionWidth(), and llvm::cl::basic_parser_impl::printOptionInfo().
|
static |
HandlePrefixedOrGroupedOption - The specified argument string (which started with at least one '-') does not fully match an available option. Check to see if this is a prefix or grouped option. If so, split arg into output an Arg/Value pair and return the Option to parse it with.
Definition at line 385 of file CommandLine.cpp.
References llvm::StringMap< ValueTy, AllocatorTy >::count(), llvm::NVPTXISD::Dummy, llvm::StringMap< ValueTy, AllocatorTy >::find(), llvm::cl::Option::getFormattingFlag(), getOptionPred(), llvm::cl::Option::getValueExpectedFlag(), isGrouping(), isPrefixedOrGrouping(), llvm::cl::Prefix, ProvideOption(), llvm::StringRef::size(), llvm::StringRef::substr(), and llvm::cl::ValueRequired.
Referenced by llvm::cl::ParseCommandLineOptions().
|
static |
Definition at line 450 of file CommandLine.cpp.
References llvm::LibFunc::strchr.
Referenced by llvm::cl::TokenizeGNUCommandLine().
Definition at line 347 of file CommandLine.cpp.
References llvm::cl::Option::getFormattingFlag(), and llvm::cl::Grouping.
Referenced by HandlePrefixedOrGroupedOption(), and isPrefixedOrGrouping().
Definition at line 350 of file CommandLine.cpp.
References llvm::cl::Option::getFormattingFlag(), isGrouping(), and llvm::cl::Prefix.
Referenced by HandlePrefixedOrGroupedOption().
|
static |
Definition at line 446 of file CommandLine.cpp.
Referenced by llvm::cl::TokenizeGNUCommandLine().
|
static |
Definition at line 442 of file CommandLine.cpp.
References llvm::LibFunc::strchr.
Referenced by llvm::cl::TokenizeGNUCommandLine(), and llvm::cl::TokenizeWindowsCommandLine().
|
static |
LookupNearestOption - Lookup the closest match to the option specified by the specified option on the command line. If there is a value specified (after an equal sign) return that as well. This assumes that leading dashes have already been stripped.
Definition at line 207 of file CommandLine.cpp.
References llvm::cl::Option::ArgStr, llvm::StringMap< ValueTy, AllocatorTy >::begin(), llvm::StringRef::edit_distance(), llvm::StringRef::empty(), llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::cl::Option::getExtraOptionNames(), llvm::cl::Option::getValueExpectedFlag(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::StringRef::split(), llvm::StringRef::str(), and llvm::cl::ValueDisallowed.
Referenced by llvm::cl::ParseCommandLineOptions().
|
static |
LookupOption - Lookup the option specified by the specified option on the command line. If there is a value specified (after an equal sign) return that as well. This assumes that leading dashes have already been stripped.
Definition at line 178 of file CommandLine.cpp.
References llvm::StringRef::empty(), llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::StringRef::find(), llvm::StringMap< ValueTy, AllocatorTy >::find(), I, llvm::StringRef::npos, llvm::StringMapEntry< ValueTy >::second, and llvm::StringRef::substr().
Referenced by llvm::cl::ParseCommandLineOptions().
|
static |
Definition at line 1375 of file CommandLine.cpp.
References llvm::LibFunc::strcmp.
Referenced by sortOpts().
|
static |
Backslashes are interpreted in a rather complicated way in the Windows-style command line, because backslashes are used both to separate path and to escape double quote. This method consumes runs of backslashes as well as the following double quote if it's escaped.
Definition at line 521 of file CommandLine.cpp.
References llvm::SmallString< InternalLen >::append(), I, llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), and llvm::StringRef::size().
Referenced by llvm::cl::TokenizeWindowsCommandLine().
Definition at line 1203 of file CommandLine.cpp.
References llvm::StringRef::begin(), llvm::SmallString< InternalLen >::c_str(), llvm::StringRef::end(), llvm::cl::Option::error(), and llvm::LibFunc::strtod.
|
static |
Definition at line 1084 of file CommandLine.cpp.
References llvm::raw_ostream::indent(), llvm::outs(), Split(), and llvm::StringRef::split().
Referenced by llvm::cl::generic_parser_base::printOptionInfo(), and llvm::cl::basic_parser_impl::printOptionInfo().
|
inlinestatic |
ProvideOption - For Value, this differentiates between an empty value ("") and a null value (StringRef()). The later is accepted for arguments that don't allow a value (-foo) the former is rejected (-foo=).
Definition at line 284 of file CommandLine.cpp.
References CommaSeparateAndAddOccurence(), llvm::StringRef::data(), llvm::cl::Option::error(), llvm::cl::Option::getNumAdditionalVals(), llvm::cl::Option::getValueExpectedFlag(), llvm::cl::ValueDisallowed, llvm::cl::ValueOptional, and llvm::cl::ValueRequired.
Referenced by HandlePrefixedOrGroupedOption(), llvm::cl::ParseCommandLineOptions(), and ProvidePositionalOption().
Definition at line 340 of file CommandLine.cpp.
References llvm::cl::Option::ArgStr, llvm::NVPTXISD::Dummy, and ProvideOption().
Referenced by llvm::cl::ParseCommandLineOptions().
Definition at line 432 of file CommandLine.cpp.
References llvm::cl::Option::getNumOccurrencesFlag(), llvm::cl::OneOrMore, and llvm::cl::Required.
Referenced by llvm::cl::ParseCommandLineOptions().
|
static |
Definition at line 1383 of file CommandLine.cpp.
References llvm::StringMap< ValueTy, AllocatorTy >::begin(), llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::cl::Hidden, I, llvm::SmallPtrSet< PtrType, SmallSize >::insert(), OptNameCompare(), llvm::LibFunc::qsort, and llvm::cl::ReallyHidden.
Referenced by llvm::cl::PrintOptionValues().
|
static |
Referenced by llvm::cl::PrintHelpMessage().
|
static |
Referenced by llvm::cl::PrintHelpMessage().
|
static |
|
static |
|
static |
Definition at line 1679 of file CommandLine.cpp.
Referenced by llvm::cl::AddExtraVersionPrinter().
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 1286 of file CommandLine.cpp.
Referenced by llvm::cl::generic_parser_base::printGenericOptionDiff().
|
static |
Definition at line 88 of file CommandLine.cpp.
Referenced by llvm::cl::extrahelp::extrahelp(), and llvm::cl::ParseCommandLineOptions().
Definition at line 95 of file CommandLine.cpp.
Referenced by llvm::cl::MarkOptionsChanged(), and llvm::cl::ParseCommandLineOptions().
|
static |
Definition at line 1677 of file CommandLine.cpp.
Referenced by llvm::cl::SetVersionPrinter().
|
static |
Referenced by llvm::cl::PrintOptionValues().
|
static |
Referenced by llvm::cl::PrintOptionValues().
|
static |
Definition at line 84 of file CommandLine.cpp.
Referenced by llvm::cl::Option::error(), GetOptionInfo(), and llvm::cl::ParseCommandLineOptions().
|
static |
Definition at line 85 of file CommandLine.cpp.
Referenced by llvm::cl::ParseCommandLineOptions().
|
static |
Definition at line 116 of file CommandLine.cpp.
|
static |
RegisteredOptionList - This is the list of the command line options that have statically constructed themselves.
Definition at line 104 of file CommandLine.cpp.
Referenced by llvm::cl::Option::addArgument(), and GetOptionInfo().
|
static |
Definition at line 1735 of file CommandLine.cpp.
Referenced by llvm::cl::PrintVersionMessage().
|
static |