Abstract base class for command line parsers.
Is capable of storing and parsing commmand line options.
Definition at line 53 of file CmdLineParser.hh.
Try to find a particular option.
- Parameters
-
name | The name of the option. |
- Returns
- The option if it is found.
- Exceptions
-
Definition at line 160 of file CmdLineParser.cc.
171 string msg =
"Unknown option: " + name;
172 string method =
"CmdLineParser::findOption()";
References optionLongNames_, and optionShortNames_.
Referenced by ExplorerCmdLineOptions::adfFile(), TTAUnitTesterCmdLineOptions::adfFileName(), ExplorerCmdLineOptions::adfFileName(), ExplorerCmdLineOptions::adfOutFile(), ExplorerCmdLineOptions::adfOutFileName(), LLVMTCECmdLineOptions::analyzeInstructionPatterns(), ExplorerCmdLineOptions::applicationIDToRemove(), ExplorerCmdLineOptions::applicationIDToRemoveCount(), LLVMTCECmdLineOptions::assumeADFStackAlignment(), ProGeCmdLineOptions::asyncReset(), LLVMTCECmdLineOptions::backendCacheDir(), SimulatorCmdLineOptions::backendType(), PIGCmdLineOptions::bemFile(), ProGeCmdLineOptions::bemFile(), SchedulerCmdLineOptions::bypassDistance(), ProGeCmdLineOptions::clockFrequency(), ProGeCmdLineOptions::commaSeparatedList(), ExplorerCmdLineOptions::compilerOptions(), ExplorerCmdLineOptions::compilerOptionsString(), PIGCmdLineOptions::compressorParameter(), PIGCmdLineOptions::compressorParameterCount(), PIGCmdLineOptions::compressorPlugin(), ExplorerCmdLineOptions::configurationToWrite(), LLVMTCECmdLineOptions::conservativePreRAScheduler(), PIGCmdLineOptions::dataImageOutputFormat(), PIGCmdLineOptions::dataMemoryWidthInMAUs(), LLVMTCECmdLineOptions::dataStartAddress(), LLVMTCECmdLineOptions::debugFlag(), SimulatorCmdLineOptions::debugMode(), ProGeCmdLineOptions::deviceFamilyName(), ProGeCmdLineOptions::deviceName(), LLVMTCECmdLineOptions::disableAddressSpaceAA(), LLVMTCECmdLineOptions::disableDelaySlotFiller(), LLVMTCECmdLineOptions::disableHWLoops(), LLVMTCECmdLineOptions::disableLLVMAA(), ProGeCmdLineOptions::dmemType(), LLVMTCECmdLineOptions::dumpDDGsDot(), LLVMTCECmdLineOptions::dumpDDGsXML(), SchedulerCmdLineOptions::dumpIfConversionCFGs(), SchedulerCmdLineOptions::enableOffsetAA(), SchedulerCmdLineOptions::enableStackAA(), PIGCmdLineOptions::entityName(), ProGeCmdLineOptions::entityName(), ExplorerCmdLineOptions::explorerPlugin(), ExplorerCmdLineOptions::explorerPluginParameter(), ExplorerCmdLineOptions::explorerPluginParameterCount(), DisasmCmdLineOptions::flatFile(), ProGeCmdLineOptions::forceOutputDirectory(), TestHDBCmdLineOptions::fuEntryID(), PIGCmdLineOptions::generateDataImages(), PIGCmdLineOptions::generateDecompressor(), LLVMTCECmdLineOptions::generatePluginOnly(), ProGeCmdLineOptions::generateTestbench(), LLVMTCECmdLineOptions::getLLVMargv(), ExplorerCmdLineOptions::hdbFileName(), ExplorerCmdLineOptions::hdbFileNameCount(), ExplorerCmdLineOptions::hdbFileNames(), ProGeCmdLineOptions::hdl(), ProGeCmdLineOptions::idfFile(), ExplorerCmdLineOptions::idfFile(), ExplorerCmdLineOptions::idfFileName(), SchedulerCmdLineOptions::ifConversionThreshold(), BuildOpsetOptions::ignore(), ProGeCmdLineOptions::imemType(), LLVMTCECmdLineOptions::initialStackPointerValue(), ProGeCmdLineOptions::integratorName(), LLVMTCECmdLineOptions::isDataStartAddressSet(), TestHDBCmdLineOptions::isFUEntryIDGiven(), LLVMTCECmdLineOptions::isInitialStackPointerValueSet(), SchedulerCmdLineOptions::isLoopOptDefined(), SchedulerCmdLineOptions::isMachineFileDefined(), LLVMTCECmdLineOptions::isOptLevelDefined(), SchedulerCmdLineOptions::isOutputFileDefined(), TestHDBCmdLineOptions::isRFEntryIDGiven(), LLVMTCECmdLineOptions::isStandardEmulationLibDefined(), CmdLineOptions::isVerboseSpamSwitchDefined(), LLVMTCECmdLineOptions::isVerboseSwitchDefined(), CmdLineOptions::isVerboseSwitchDefined(), LLVMTCECmdLineOptions::isWorkItemAAFileDefined(), SchedulerCmdLineOptions::killDeadResults(), TTAUnitTesterCmdLineOptions::leaveDirty(), TestHDBCmdLineOptions::leaveDirty(), DisasmCmdLineOptions::lineNumbers(), ProGeCmdLineOptions::listAvailableIntegrators(), EstimatorCmdLineOptions::longestPath(), SchedulerCmdLineOptions::lowMemModeThreshold(), SchedulerCmdLineOptions::machineFile(), SimulatorCmdLineOptions::machineFile(), SchedulerCmdLineOptions::noaliasFunctions(), SchedulerCmdLineOptions::noDreBypassDistance(), ExplorerCmdLineOptions::numberOfConfigurations(), ExplorerCmdLineOptions::numberOfConfigurationsToWrite(), DumperCmdLineOptions::onlyLogicalInfo(), SchedulerCmdLineOptions::operandShareDistance(), CmdLineOptions::optionGiven(), LLVMTCECmdLineOptions::optLevel(), ProGeCmdLineOptions::outputDirectory(), BEMGeneratorCmdLineOptions::outputFile(), SchedulerCmdLineOptions::outputFile(), DisasmCmdLineOptions::outputFile(), DisasmCmdLineOptions::outputFileDefined(), MachInfoCmdLineOptions::outputFileNameSuffix(), MachInfoCmdLineOptions::outputFormat(), ExplorerCmdLineOptions::paretoSetValues(), CmdLineOptions::parseAll(), parseAll(), ExplorerCmdLineOptions::pluginInfo(), ProGeCmdLineOptions::pluginParametersQuery(), ProGeCmdLineOptions::preferHDLGeneration(), LLVMTCECmdLineOptions::primaryFunctions(), ExplorerCmdLineOptions::printApplications(), DumperCmdLineOptions::printFileHeaders(), CmdLineOptions::printHelp(), LLVMTCECmdLineOptions::printInlineAsmWarnings(), DumperCmdLineOptions::printMemoryInfo(), ExplorerCmdLineOptions::printPlugins(), DumperCmdLineOptions::printRelocations(), SchedulerCmdLineOptions::printResourceConstraints(), DumperCmdLineOptions::printSectionHeaders(), ExplorerCmdLineOptions::printSummary(), DumperCmdLineOptions::printSymbols(), DisasmCmdLineOptions::printToStdout(), PIGCmdLineOptions::progeOutputDirectory(), SimulatorCmdLineOptions::programFile(), PIGCmdLineOptions::programImageOutputFormat(), SchedulerCmdLineOptions::renameRegisters(), ProGeCmdLineOptions::resetAllRegisters(), TestHDBCmdLineOptions::rfEntryID(), EstimatorCmdLineOptions::runOnlyEstimations(), LLVMTCECmdLineOptions::saveBackendPlugin(), SchedulerCmdLineOptions::schedulingWindowSize(), SimulatorCmdLineOptions::scriptString(), DumperCmdLineOptions::sectionId(), DumperCmdLineOptions::sectionIdCount(), ProGeCmdLineOptions::sharedOutputDirectory(), PIGCmdLineOptions::showCompressors(), ProGeCmdLineOptions::simulationRuntime(), BuildOpsetOptions::sourceDir(), LLVMTCECmdLineOptions::standardEmulationLib(), ExplorerCmdLineOptions::startConfiguration(), ExplorerCmdLineOptions::summaryOrdering(), ProGeCmdLineOptions::syncReset(), LLVMTCECmdLineOptions::tempDir(), ExplorerCmdLineOptions::testApplicationDirectory(), ExplorerCmdLineOptions::testApplicationDirectoryCount(), EstimatorCmdLineOptions::totalArea(), EstimatorCmdLineOptions::totalEnergy(), EstimatorCmdLineOptions::TPEF(), PIGCmdLineOptions::tpefFile(), PIGCmdLineOptions::tpefFileCount(), ProGeCmdLineOptions::tpefName(), EstimatorCmdLineOptions::traceDB(), ProGeCmdLineOptions::useAbsolutePaths(), LLVMTCECmdLineOptions::useBubbleFish2Scheduler(), LLVMTCECmdLineOptions::useBUScheduler(), LLVMTCECmdLineOptions::useOldBackendSources(), SchedulerCmdLineOptions::useRestrictedAliasAnalyzer(), LLVMTCECmdLineOptions::useTDScheduler(), LLVMTCECmdLineOptions::useVectorBackend(), TTAUnitTesterCmdLineOptions::verbose(), TestHDBCmdLineOptions::verbose(), TTAUnitTesterCmdLineOptions::vhdlSim(), TestHDBCmdLineOptions::vhdlSim(), LLVMTCECmdLineOptions::workItemAAFile(), ExplorerCmdLineOptions::writeOutBestConfiguration(), and ExplorerCmdLineOptions::writeOutConfiguration().
bool CmdLineParser::parseOption |
( |
std::string |
option, |
|
|
std::string & |
name, |
|
|
std::string & |
arguments, |
|
|
std::string & |
prefix, |
|
|
bool & |
hasArgument |
|
) |
| const |
|
protected |
Parses one option.
Each option should have name and prefix (-, –, -no, or –no). Arguments are mandatory for all except Boolean options.
- Parameters
-
option | The whole option. |
name | The name of the option. |
arguments | The arguments for option. |
prefix | The prefix of option. |
hasArgument | False if argument is part of option body (eg. -abc). |
- Returns
- True if option is command line option, false if option is command line argument.
- Exceptions
-
Definition at line 277 of file CmdLineParser.cc.
281 bool longOption =
false;
282 if (!
readPrefix(option, prefix, longOption)) {
288 unsigned int pos = 0;
289 while (pos < option.length() && option[pos] !=
'=') {
292 name = option.substr(0, pos);
293 option.erase(0, pos);
296 name = option.substr(0, 1);
301 if (option.length() > 0 && option[0] ==
'=') {
303 string method =
"CmdLineParser::parseOption()";
304 string message =
"Illegal short option: = not allowed.";
311 if (arguments ==
"" || !longOption) {
References readPrefix().
Referenced by CmdLineOptions::parseAll(), and parseAll().