Lines Matching refs:StringRef
27 #include "llvm/ADT/StringRef.h"
101 static StringRef ArgPrefix = "-";
102 static StringRef ArgPrefixLong = "--";
103 static StringRef ArgHelpPrefix = " - ";
105 static size_t argPlusPrefixesSize(StringRef ArgName, size_t Pad = DefaultPad) {
112 static SmallString<8> argPrefix(StringRef ArgName, size_t Pad = DefaultPad) {
134 StringRef ArgName;
137 PrintArg(StringRef ArgName, size_t Pad = DefaultPad) : ArgName(ArgName), Pad(Pad) {}
151 StringRef ProgramOverview;
154 std::vector<StringRef> MoreHelp;
175 StringRef Overview, raw_ostream *Errs = nullptr,
178 void addLiteralOption(Option &Opt, SubCommand *SC, StringRef Name) {
198 void addLiteralOption(Option &Opt, StringRef Name) {
269 SmallVector<StringRef, 16> OptionNames;
330 void updateArgStr(Option *O, StringRef NewName, SubCommand *SC) {
340 void updateArgStr(Option *O, StringRef NewName) {
402 ProgramOverview = StringRef();
421 Option *LookupOption(SubCommand &Sub, StringRef &Arg, StringRef &Value);
422 Option *LookupLongOption(SubCommand &Sub, StringRef &Arg, StringRef &Value,
429 SubCommand *LookupSubCommand(StringRef Name);
436 void cl::AddLiteralOption(Option &O, StringRef Name) {
440 extrahelp::extrahelp(StringRef Help) : morehelp(Help) {
451 void Option::setArgStr(StringRef S) {
522 Option *CommandLineParser::LookupOption(SubCommand &Sub, StringRef &Arg,
523 StringRef &Value) {
532 if (EqualPos == StringRef::npos) {
557 SubCommand *CommandLineParser::LookupSubCommand(StringRef Name) {
566 if (StringRef(S->getName()) == StringRef(Name))
576 static Option *LookupNearestOption(StringRef Arg,
584 std::pair<StringRef, StringRef> SplitArg = Arg.split('=');
585 StringRef &LHS = SplitArg.first; // LHS == Arg when no '=' is present.
586 StringRef &RHS = SplitArg.second;
599 SmallVector<StringRef, 16> OptionNames;
605 StringRef Flag = PermitValue ? LHS : Arg;
607 unsigned Distance = StringRef(Name).edit_distance(
626 StringRef ArgName, StringRef Value,
631 StringRef Val(Value);
632 StringRef::size_type Pos = Val.find(',');
634 while (Pos != StringRef::npos) {
651 /// and a null value (StringRef()). The later is accepted for arguments that
653 static inline bool ProvideOption(Option *Handler, StringRef ArgName,
654 StringRef Value, int argc,
669 Value = StringRef(argv[++i]);
703 Value = StringRef(argv[++i]);
713 bool llvm::cl::ProvidePositionalOption(Option *Handler, StringRef Arg, int i) {
724 static Option *getOptionPred(StringRef Name, size_t &Length,
753 HandlePrefixedOrGroupedOption(StringRef &Arg, StringRef &Value,
766 StringRef MaybeValue =
767 (Length < Arg.size()) ? Arg.substr(Length) : StringRef();
796 ErrorParsing |= ProvideOption(PGOpt, Arg, StringRef(), 0, nullptr, Dummy);
827 void cl::TokenizeGNUCommandLine(StringRef Src, StringSaver &Saver,
871 NewArgv.push_back(Saver.save(StringRef(Token)).data());
882 NewArgv.push_back(Saver.save(StringRef(Token)).data());
905 static size_t parseBackslash(StringRef Src, size_t I, SmallString<128> &Token) {
934 tokenizeWindowsCommandLineImpl(StringRef Src, StringSaver &Saver,
935 function_ref<void(StringRef)> AddToken,
957 StringRef NormalChars = Src.slice(Start, I);
1020 void cl::TokenizeWindowsCommandLine(StringRef Src, StringSaver &Saver,
1023 auto AddToken = [&](StringRef Tok) { NewArgv.push_back(Tok.data()); };
1032 void cl::TokenizeWindowsCommandLineNoCopy(StringRef Src, StringSaver &Saver,
1033 SmallVectorImpl<StringRef> &NewArgv) {
1034 auto AddToken = [&](StringRef Tok) { NewArgv.push_back(Tok); };
1040 void cl::tokenizeConfigFile(StringRef Source, StringSaver &Saver,
1087 StringRef FName, StringSaver &Saver, TokenizerCallback Tokenizer,
1096 StringRef Str(MemBuf.getBufferStart(), MemBuf.getBufferSize());
1105 Str = StringRef(UTF8Buf);
1111 Str = StringRef(BufRef.data() + 3, BufRef.size() - 3);
1118 llvm::StringRef BasePath = llvm::sys::path::parent_path(FName);
1127 StringRef FileName(Arg + 1);
1146 llvm::Optional<llvm::StringRef> CurrentDir) {
1254 bool cl::readConfigFile(StringRef CfgFile, StringSaver &Saver,
1286 llvm::Optional<std::string> envValue = sys::Process::GetEnv(StringRef(envVar));
1301 ParseCommandLineOptions(newArgc, &newArgv[0], StringRef(Overview));
1305 StringRef Overview, raw_ostream *Errs,
1316 sys::Process::GetEnv(StringRef(EnvVar)))
1341 StringRef Overview,
1358 ProgramName = std::string(sys::path::filename(StringRef(argv[0])));
1377 ChosenSubCommand = LookupSubCommand(StringRef(argv[FirstArg]));
1438 SmallVector<std::pair<StringRef, unsigned>, 4> PositionalVals;
1451 StringRef Value;
1452 StringRef ArgName = "";
1462 ProvidePositionalOption(ActivePositionalArg, StringRef(argv[i]), i);
1467 PositionalVals.push_back(std::make_pair(StringRef(argv[i]), i));
1474 PositionalVals.push_back(std::make_pair(StringRef(argv[i]), i));
1490 ArgName = StringRef(argv[i] + 1);
1500 ProvidePositionalOption(ActivePositionalArg, StringRef(argv[i]), i);
1504 ArgName = StringRef(argv[i] + 1);
1542 (*I)->addOccurrence(i, "", StringRef(argv[i]));
1682 bool Option::error(const Twine &Message, StringRef ArgName, raw_ostream &Errs) {
1694 bool Option::addOccurrence(unsigned pos, StringRef ArgName, StringRef Value,
1720 static StringRef getValueStr(const Option &O, StringRef DefaultMsg) {
1735 void Option::printHelpStr(StringRef HelpStr, size_t Indent,
1738 std::pair<StringRef, StringRef> Split = HelpStr.split('\n');
1802 bool parser<bool>::parse(Option &O, StringRef ArgName, StringRef Arg,
1820 bool parser<boolOrDefault>::parse(Option &O, StringRef ArgName, StringRef Arg,
1838 bool parser<int>::parse(Option &O, StringRef ArgName, StringRef Arg,
1847 bool parser<long>::parse(Option &O, StringRef ArgName, StringRef Arg,
1856 bool parser<long long>::parse(Option &O, StringRef ArgName, StringRef Arg,
1865 bool parser<unsigned>::parse(Option &O, StringRef ArgName, StringRef Arg,
1875 bool parser<unsigned long>::parse(Option &O, StringRef ArgName, StringRef Arg,
1885 bool parser<unsigned long long>::parse(Option &O, StringRef ArgName,
1886 StringRef Arg,
1896 static bool parseDouble(Option &O, StringRef Arg, double &Value) {
1902 bool parser<double>::parse(Option &O, StringRef ArgName, StringRef Arg,
1907 bool parser<float>::parse(Option &O, StringRef ArgName, StringRef Arg,
1922 unsigned generic_parser_base::findOption(StringRef Name) {
1932 static StringRef EqValue = "=<value>";
1933 static StringRef EmptyOption = "<empty>";
1934 static StringRef OptionPrefix = " =";
1937 static bool shouldPrintOption(StringRef Name, StringRef Description,
1949 StringRef Name = getOption(i);
1988 StringRef OptionName = getOption(i);
1989 StringRef Description = getDescription(i);
2008 StringRef Option = getOption(i);
2081 void parser<std::string>::printOptionDiff(const Option &O, StringRef V,
2620 llvm::cl::ParseCommandLineOptions(argc, argv, StringRef(Overview),