Home | History | Annotate | Download | only in Support

Lines Matching refs:Option

65 void Option::anchor() {}
101 static Option *RegisteredOptionList = 0;
103 void Option::addArgument() {
111 // This collects the different option categories that have been registered.
115 // Initialise the general option category.
124 // Basic, shared command line option processing machinery.
129 static void GetOptionInfo(SmallVectorImpl<Option*> &PositionalOpts,
130 SmallVectorImpl<Option*> &SinkOpts,
131 StringMap<Option*> &OptionsMap) {
133 Option *CAOpt = 0; // The ConsumeAfter option if it exists.
134 for (Option *O = RegisteredOptionList; O; O = O->getNextRegisteredOption()) {
135 // If this option wants to handle multiple option names, get the full set.
159 O->error("Cannot specify more than one option with cl::ConsumeAfter!");
172 /// LookupOption - Lookup the option specified by the specified option on the
175 static Option *LookupOption(StringRef &Arg, StringRef &Value,
176 const StringMap<Option*> &OptionsMap) {
184 // Look up the option.
185 StringMap<Option*>::const_iterator I = OptionsMap.find(Arg);
189 // If the argument before the = is a valid option name, we match. If not,
191 StringMap<Option*>::const_iterator I =
200 /// LookupNearestOption - Lookup the closest match to the option specified by
201 /// the specified option on the command line. If there is a value specified
204 static Option *LookupNearestOption(StringRef Arg,
205 const StringMap<Option*> &OptionsMap,
216 Option *Best = 0;
218 for (StringMap<Option*>::const_iterator it = OptionsMap.begin(),
220 Option *O = it->second;
248 static bool CommaSeparateAndAddOccurence(Option *Handler, unsigned pos,
252 // Check to see if this option accepts a comma separated list of values. If
281 static inline bool ProvideOption(Option *Handler, StringRef ArgName,
284 // Is this a multi-argument option?
299 return Handler->error("multi-valued option specified"
310 // If this isn't a multi-arg option, just run the handler.
337 static bool ProvidePositionalOption(Option *Handler, StringRef Arg, int i) {
343 // Option predicates...
344 static inline bool isGrouping(const Option *O) {
347 static inline bool isPrefixedOrGrouping(const Option *O) {
357 static Option *getOptionPred(StringRef Name, size_t &Length,
358 bool (*Pred)(const Option*),
359 const StringMap<Option*> &OptionsMap) {
361 StringMap<Option*>::const_iterator OMI = OptionsMap.find(Name);
363 // Loop while we haven't found an option and Name still has at least two
375 return 0; // No option found!
379 /// with at least one '-') does not fully match an available option. Check to
380 /// see if this is a prefix or grouped option. If so, split arg into output an
381 /// Arg/Value pair and return the Option to parse it with.
382 static Option *HandlePrefixedOrGroupedOption(StringRef &Arg, StringRef &Value,
384 const StringMap<Option*> &OptionsMap) {
389 Option *PGOpt = getOptionPred(Arg, Length, isPrefixedOrGrouping, OptionsMap);
392 // If the option is a prefixed option, then the value is simply the
402 // This must be a grouped option... handle them now. Grouping options can't
414 "Option can not be cl::Grouping AND cl::ValueRequired!");
419 // Get the next grouping option.
423 // Return the last option with Arg cut down to just the last one.
429 static bool RequiresValue(const Option *O) {
434 static bool EatsUnboundedNumberOfValues(const Option *O) {
715 SmallVector<Option*, 4> PositionalOpts;
716 SmallVector<Option*, 4> SinkOpts;
717 StringMap<Option*> Opts;
747 Option *ConsumeAfterOpt = 0;
759 Option *Opt = PositionalOpts[i];
767 Opt->error("error - this positional option will never be matched, "
769 "cl::ConsumeAfter option is active!");
771 // This option does not "require" a value... Make sure this option is
772 // not specified after an option that eats all extra arguments, or this
775 ErrorParsing |= Opt->error("error - option can never match, because "
777 "unbounded number of values, and this option"
793 Option *ActivePositionalArg = 0;
798 Option *Handler = 0;
799 Option *NearestHandler = 0;
804 // If the option list changed, this means that some command line
805 // option has just been registered or deregistered. This can occur in
830 // the consume after option... if it's specified...
849 // option is another positional argument. If so, treat it as an argument,
870 // Check to see if this "option" is really a prefixed or grouped argument.
875 // Otherwise, look for the closest available option to report to the user
895 for (SmallVectorImpl<Option*>::iterator I = SinkOpts.begin(),
937 // If we _can_ give this option more arguments, do so now, as long as we
939 // option even _WANTS_ any more.
971 // Handle the case where there is just one positional option, and it's
972 // optional. In this case, we want to give JUST THE FIRST option to the
973 // positional option and keep the rest for the consume after. The above
984 // cl::ConsumeAfter command line option...
992 for (StringMap<Option*>::iterator I = Opts.begin(),
1027 // Option Base class implementation
1030 bool Option::error(const Twine &Message, StringRef ArgName) {
1037 errs() << " option: " << Message << "\n";
1041 bool Option::addOccurrence(unsigned pos, StringRef ArgName,
1067 static const char *getValueStr(const Option &O, const char *DefaultMsg) {
1076 // Return the width of the option tag for printing...
1091 // Print out the option for the alias.
1104 // Return the width of the option tag for printing...
1105 size_t basic_parser_impl::getOptionWidth(const Option &O) const {
1113 // printOptionInfo - Print out information about this option. The
1116 void basic_parser_impl::printOptionInfo(const Option &O,
1126 void basic_parser_impl::printOptionName(const Option &O,
1135 bool parser<bool>::parse(Option &O, StringRef ArgName,
1153 bool parser<boolOrDefault>::parse(Option &O, StringRef ArgName,
1171 bool parser<int>::parse(Option &O, StringRef ArgName,
1180 bool parser<unsigned>::parse(Option &O, StringRef ArgName,
1190 bool parser<unsigned long long>::parse(Option &O, StringRef ArgName,
1200 static bool parseDouble(Option &O, StringRef Arg, double &Value) {
1210 bool parser<double>::parse(Option &O, StringRef ArgName,
1215 bool parser<float>::parse(Option &O, StringRef ArgName,
1229 // findOption - Return the option number corresponding to the specified
1230 // argument string. If the option is not found, getNumOptions() is returned.
1243 // Return the width of the option tag for printing...
1244 size_t generic_parser_base::getOptionWidth(const Option &O) const {
1258 // printOptionInfo - Print out information about this option. The
1261 void generic_parser_base::printOptionInfo(const Option &O,
1276 const char *Option = getOption(i);
1277 outs() << " -" << Option;
1278 printHelpStr(getDescription(i), GlobalWidth, std::strlen(Option) + 8);
1285 // printGenericOptionDiff - Print the value of this option and it's default.
1289 printGenericOptionDiff(const Option &O, const GenericOptionValue &Value,
1313 outs() << "= *unknown option value*\n";
1320 printOptionDiff(const Option &O, T V, OptionValue<T> D, \
1348 printOptionDiff(const Option &O, StringRef V, OptionValue<std::string> D,
1363 printOptionNoValue(const Option &O, size_t GlobalWidth) const {
1365 outs() << "= *cannot print option value*\n";
1369 // -help and -help-hidden option implementation
1373 typedef std::pair<const char *, Option*> pair_ty;
1380 sortOpts(StringMap<Option*> &OptMap,
1381 SmallVectorImpl< std::pair<const char *, Option*> > &Opts,
1383 SmallPtrSet<Option*, 128> OptionSet; // Duplicate option detection.
1385 for (StringMap<Option*>::iterator I = OptMap.begin(), E = OptMap.end();
1395 // If we've already seen this option, don't add it to the list again.
1399 Opts.push_back(std::pair<const char *, Option*>(I->getKey().data(),
1412 typedef SmallVector<std::pair<const char *, Option*>,128> StrOptionPairVector;
1428 SmallVector<Option*, 4> PositionalOpts;
1429 SmallVector<Option*, 4> SinkOpts;
1430 StringMap<Option*> OptMap;
1442 Option *CAOpt = 0; // The cl::ConsumeAfter option, if it exists...
1453 // Print the consume after option info if it exists...
1487 assert(Length != 0 && "Duplicate option categories");
1497 std::map<OptionCategory *, std::vector<Option *> > CategorizedOptions;
1499 // Collect registered option categories into vector in preperation for
1506 // Sort the different option categories alphabetically.
1507 assert(SortedCategories.size() > 0 && "No option categories registered!");
1516 CategorizedOptions[*I] = std::vector<Option *>();
1522 Option *Opt = Opts[I].second;
1524 "Option has an unregistered category");
1551 outs() << " This option category has no options.\n";
1555 for (std::vector<Option *>::const_iterator
1599 // -help-list is hidden by default because if Option categories are being used
1612 // behaviour at runtime depending on whether one or more Option categories have
1631 cl::desc("Print all option values after command line parsing"),
1638 // Decide which printer to invoke. If more than one option category is
1642 // unhide -help-list option so user can have uncategorized output if they
1652 // Print the value of each option.
1657 SmallVector<Option*, 4> PositionalOpts;
1658 SmallVector<Option*, 4> SinkOpts;
1659 StringMap<Option*> OptMap;
1662 SmallVector<std::pair<const char *, Option*>, 128> Opts;
1731 // Define the --version option that prints out the LLVM version for the tool
1773 void cl::getRegisteredOptions(StringMap<Option*> &Map)
1776 SmallVector<Option*, 4> PositionalOpts; //NOT USED
1777 SmallVector<Option*, 4> SinkOpts; //NOT USED