LLVM: include/llvm/Support/CommandLine.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef LLVM_SUPPORT_COMMANDLINE_H
20#define LLVM_SUPPORT_COMMANDLINE_H
21
34#include
35#include
36#include
37#include
38#include <initializer_list>
39#include
40#include <type_traits>
41#include
42
43namespace llvm {
44
45namespace vfs {
47}
48
50
51
52
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
73 const char *EnvVar = nullptr,
74 bool LongOptionsUseDoubleDash = false);
75
76
78
79
80
81
82
84
85
86
87
88
89
91
92
93
94
95
97
98
100
101
102
103
104
105
106
107
109
110
111
112
113
129
136
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
163
178
179
180
182private:
185
186 LLVM_ABI void registerCategory();
187
188public:
190 StringRef const Description = "")
191 : Name(Name), Description(Description) {
192 registerCategory();
193 }
194
197};
198
199
201
202
203
205private:
208
209protected:
212
213public:
215 : Name(Name), Description(Description) {
217 }
219
220
222
223
224
226
228
230
233
237
239};
240
243
244public:
245 SubCommandGroup(std::initializer_list<SubCommand *> IL) : Subs(IL) {}
246
248};
249
250
251
254
255
256
257
258
259 virtual bool handleOccurrence(unsigned pos, StringRef ArgName,
261
262 virtual enum ValueExpected getValueExpectedFlagDefault() const {
264 }
265
266
267 virtual void anchor();
268
269 uint16_t NumOccurrences;
270
271
272 uint16_t Occurrences : 3;
273
274
276 uint16_t HiddenFlag : 2;
277 uint16_t Formatting : 2;
279 uint16_t FullyInitialized : 1;
280 uint16_t Position;
281 uint16_t AdditionalVals;
282
283public:
290
294
296 return Value ? ((enum ValueExpected)Value) : getValueExpectedFlagDefault();
297 }
298
302
306
308 inline unsigned getPosition() const { return Position; }
310
311
316
320
321
322
323
335
336protected:
339 : NumOccurrences(0), Occurrences(OccurrencesFlag), Value(0),
341 FullyInitialized(false), Position(0), AdditionalVals(0) {
343 }
344
346
347public:
349
350
351
353
354
355
356
357
359
360
362
363
364
365
367
369
371
372
373
374
375
376
378 size_t FirstLineIndentedBy);
379
380
381
382
383
384
386 size_t FirstLineIndentedBy);
387
389
390
391
393 bool MultiArg = false);
394
395
400
402 void reset();
403};
404
405
406
407
408
409
410
418
419
427
428
429
430
434
435 template void apply(Opt &O) const { O.setInitialValue(Init); }
436};
437
441
442 template void apply(Opt &O) const { O.setInitialValues(Inits); }
443};
444
448
449template
453
454
455
456
459
461
462 template void apply(Opt &O) const { O.setLocation(O, Loc); }
463};
464
468
469
472
474
475 template void apply(Opt &O) const { O.addCategory(Category); }
476};
477
478
482
485
486 template void apply(Opt &O) const {
488 O.addSubCommand(*Sub);
491 O.addSubCommand(*SC);
492 }
493};
494
495
496
497template <typename R, typename Ty> struct cb {
499
501
502 template void apply(Opt &O) const { O.setCallback(CB); }
503};
504
506template
508
509template <typename R, typename C, typename... Args>
512 using arg_type = std::tuple_element_t<0, std::tuple<Args...>>;
513 static_assert(sizeof...(Args) == 1, "callback function must have one and only one parameter");
514 static_assert(std::is_same_v<result_type, void>,
515 "callback return type must be void");
516 static_assert(std::is_lvalue_reference_v<arg_type> &&
517 std::is_const_v<std::remove_reference_t<arg_type>>,
518 "callback arg_type must be a const lvalue reference");
519};
520}
521
522template
530
531
532
533
536
537protected:
542
543private:
544 virtual void anchor();
545};
546
547template struct OptionValue;
548
549
550
551template <class DataType, bool isClass>
553
555
557
559
560
561 template void setValue(const DT & ) {}
562
563
564 bool compare(const DataType & ) const { return false; }
565
569
570protected:
572};
573
574
576 DataType Value;
577 bool Valid = false;
578
579protected:
583
584public:
586
588
590 assert(Valid && "invalid option value");
591 return Value;
592 }
593
595 Valid = true;
596 Value = V;
597 }
598
599
600 bool compare(const DataType &V) const { return Valid && (Value == V); }
601
605 if (!VC.hasValue())
606 return false;
607 return compare(VC.getValue());
608 }
609};
610
611
612template
622
623
624template
637
638
640template <>
644
646
648
653
654private:
655 void anchor() override;
656};
657
658template <>
661
663
665
670
671private:
672 void anchor() override;
673};
674
675
676
677
678
679
685
686#define clEnumVal(ENUMVAL, DESC) \
687 llvm:🆑:OptionEnumValue { #ENUMVAL, int(ENUMVAL), DESC }
688#define clEnumValN(ENUMVAL, FLAGNAME, DESC) \
689 llvm:🆑:OptionEnumValue { FLAGNAME, int(ENUMVAL), DESC }
690
691
692
693
695
696
697
699
700public:
703
704 template void apply(Opt &O) const {
705 for (const auto &Value : Values)
707 Value.Description);
708 }
709};
710
711
712
716
717
718
719
720
721
722
723
724
725
726
727
728
730protected:
738
739public:
741
743
744
745
746
747
749
750
752
753
755
756
758
760
761
762
763
765
768 size_t GlobalWidth) const;
769
770
771
772
773
774 template
776 const AnyOptionValue &Default,
777 size_t GlobalWidth) const {
779 }
780
782
784
785
786
787 if (.hasArgStr())
788 for (unsigned i = 0, e = getNumOptions(); i != e; ++i)
790 }
791
793
794
795
796
797
798
799
800
801
802
803
804 if (Owner.hasArgStr())
806 else
808 }
809
810
811
812
813 unsigned findOption(StringRef Name);
814
815protected:
817};
818
819
820
821
822
823
824
826protected:
835
836public:
838
840
841
846 }
847
848
852
853
856 if (Owner.hasArgStr())
857 ArgVal = Arg;
858 else
859 ArgVal = ArgName;
860
861 for (size_t i = 0, e = Values.size(); i != e; ++i)
862 if (Values[i].Name == ArgVal) {
863 V = Values[i].V.getValue();
864 return false;
865 }
866
867 return O.error("Cannot find option named '" + ArgVal + "'!");
868 }
869
870
871
872 template
874#ifndef NDEBUG
877#endif
878 OptionInfo X(Name, static_cast<DataType>(V), HelpStr);
881 }
882
883
884
890};
891
892
893
894
896 basic_parser_impl {
897public:
899
901
905
907
909
910
911 size_t getOptionWidth(const Option &O) const;
912
913
914
915
916 void printOptionInfo(const Option &O, size_t GlobalWidth) const;
917
918
919 void printOptionNoValue(const Option &O, size_t GlobalWidth) const;
920
921
923
924
925 virtual void anchor();
926
927protected:
928
929 void printOptionName(const Option &O, size_t GlobalWidth) const;
930};
931
932
933
934
942
943
944
946
948public:
950
951
953
955
959
960
962
964 size_t GlobalWidth) const;
965
966
968};
969
970
971
973
974template <>
976public:
978
979
981
985
986
988
990 size_t GlobalWidth) const;
991
992
994};
995
996
997
999
1001public:
1003
1004
1006
1007
1009
1011 size_t GlobalWidth) const;
1012
1013
1015};
1016
1017
1018
1020
1022public:
1024
1025
1027
1028
1030
1032 size_t GlobalWidth) const;
1033
1034
1036};
1037
1038
1039
1041
1043public:
1045
1046
1048
1049
1051
1053 size_t GlobalWidth) const;
1054
1055
1057};
1058
1059
1060
1062
1064public:
1066
1067
1069
1070
1072
1074 size_t GlobalWidth) const;
1075
1076
1078};
1079
1080
1081
1083
1084template <>
1087public:
1089
1090
1092
1093
1095
1097 size_t GlobalWidth) const;
1098
1099
1101};
1102
1103
1104
1106
1107template <>
1110public:
1112
1113
1115 unsigned long long &Val);
1116
1117
1119
1121 size_t GlobalWidth) const;
1122
1123
1125};
1126
1127
1128
1130
1132public:
1134
1135
1137
1138
1140
1142 size_t GlobalWidth) const;
1143
1144
1146};
1147
1148
1149
1151
1153public:
1155
1156
1158
1159
1161
1163 size_t GlobalWidth) const;
1164
1165
1167};
1168
1169
1170
1172
1173template <>
1175public:
1177
1178
1181 return false;
1182 }
1183
1184
1186
1188 size_t GlobalWidth) const;
1189
1190
1192};
1193
1194
1195
1196template <>
1199public:
1201
1202
1204 std::optionalstd::string &Value) {
1206 return false;
1207 }
1208
1209
1211
1213 const OptVal &Default, size_t GlobalWidth) const;
1214
1215
1217};
1218
1219
1220
1222
1224public:
1226
1227
1230 return false;
1231 }
1232
1233
1235
1237 size_t GlobalWidth) const;
1238
1239
1241};
1242
1243
1244
1245
1246
1247
1248template <class ParserClass, class DT>
1252 P.printOptionDiff(O, OV, Default, GlobalWidth);
1253}
1254
1255
1256
1260 P.printOptionNoValue(O, GlobalWidth);
1261 }
1262};
1263
1264
1265
1269 P.printOptionDiff(O, V, Default, GlobalWidth);
1270 }
1271};
1272
1273
1274
1275template <class ParserClass, class ValDT>
1280
1282 printer.print(O, static_cast<const ParserClass &>(P), V, Default,
1283 GlobalWidth);
1284}
1285
1286
1287
1288
1289
1290
1291
1293 template static void opt(const Mod &M, Opt &O) { M.apply(O); }
1294};
1295
1296
1298 template static void opt(StringRef Str, Opt &O) {
1299 O.setArgStr(Str);
1300 }
1301};
1303 template static void opt(StringRef Str, Opt &O) {
1304 O.setArgStr(Str);
1305 }
1306};
1308 template static void opt(StringRef Str, Opt &O) {
1309 O.setArgStr(Str);
1310 }
1311};
1312
1315 O.setNumOccurrencesFlag(N);
1316 }
1317};
1318
1322
1326
1330
1334 "cl::Grouping can only apply to single character Options.");
1335 O.setMiscFlag(MF);
1336 }
1337};
1338
1339
1340template <class Opt, class Mod, class... Mods>
1341void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1343 apply(O, Ms...);
1344}
1345
1346template <class Opt, class Mod> void apply(Opt *O, const Mod &M) {
1348}
1349
1350
1351
1352
1353
1354
1355template <class DataType, bool ExternalStorage, bool isClass>
1357 DataType *Location = nullptr;
1359
1360 void check_location() const {
1361 assert(Location && "cl::location(...) not specified for a command "
1362 "line option with external storage, "
1363 "or cl::init specified before cl::location()!!");
1364 }
1365
1366public:
1368
1370 if (Location)
1371 return O.error("cl::location(x) specified more than once!");
1372 Location = &L;
1373 Default = L;
1374 return false;
1375 }
1376
1377 template void setValue(const T &V, bool initial = false) {
1378 check_location();
1379 *Location = V;
1380 if (initial)
1381 Default = V;
1382 }
1383
1385 check_location();
1386 return *Location;
1387 }
1389 check_location();
1390 return *Location;
1391 }
1392
1393 operator DataType() const { return this->getValue(); }
1394
1396};
1397
1398
1399
1400
1401
1402template
1404public:
1406
1407 template void setValue(const T &V, bool initial = false) {
1408 DataType::operator=(V);
1409 if (initial)
1411 }
1412
1414 const DataType &getValue() const { return *this; }
1415
1417};
1418
1419
1420
1421
1422
1424public:
1427
1428
1429
1431
1432 template void setValue(const T &V, bool initial = false) {
1434 if (initial)
1436 }
1439
1441
1442 operator DataType() const { return getValue(); }
1443
1444
1446};
1447
1448
1449
1450
1451template <class DataType, bool ExternalStorage = false,
1452 class ParserClass = parser>
1455 public opt_storage<DataType, ExternalStorage, std::is_class_v> {
1456 ParserClass Parser;
1457
1458 bool handleOccurrence(unsigned pos, StringRef ArgName,
1460 typename ParserClass::parser_data_type Val =
1461 typename ParserClass::parser_data_type();
1462 if (Parser.parse(*this, ArgName, Arg, Val))
1463 return true;
1467 return false;
1468 }
1469
1470 enum ValueExpected getValueExpectedFlagDefault() const override {
1471 return Parser.getValueExpectedFlagDefault();
1472 }
1473
1475 return Parser.getExtraOptionNames(OptionNames);
1476 }
1477
1478
1480 return Parser.getOptionWidth(*this);
1481 }
1482
1483 void printOptionInfo(size_t GlobalWidth) const override {
1484 Parser.printOptionInfo(*this, GlobalWidth);
1485 }
1486
1487 void printOptionValue(size_t GlobalWidth, bool Force) const override {
1491 }
1492 }
1493
1495 if constexpr (std::is_assignable_v<DataType &, DataType>) {
1499 else
1501 }
1502 }
1503
1504 void done() {
1506 Parser.initialize();
1507 }
1508
1509public:
1510
1513
1514
1516
1518
1524
1526 this->getValue() = std::forward(Val);
1529 }
1530
1531 template <class... Mods>
1532 explicit opt(const Mods &... Ms)
1534 apply(this, Ms...);
1535 done();
1536 }
1537
1539 std::function<void(const typename ParserClass::parser_data_type &)> CB) {
1541 }
1542
1543 std::function<void(const typename ParserClass::parser_data_type &)> Callback =
1544 [](const typename ParserClass::parser_data_type &) {};
1545};
1546
1547#if !(defined(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS) && defined(_MSC_VER))
1548
1549
1550
1551
1553#endif
1554
1559
1560
1561
1562
1563
1564
1565template <class DataType, class StorageClass> class list_storage {
1566 StorageClass *Location = nullptr;
1567 std::vector<OptionValue> Default =
1568 std::vector<OptionValue>();
1569 bool DefaultAssigned = false;
1570
1571public:
1573
1575
1577 if (Location)
1578 return O.error("cl::location(x) specified more than once!");
1579 Location = &L;
1580 return false;
1581 }
1582
1583 template void addValue(const T &V, bool initial = false) {
1584 assert(Location != nullptr &&
1585 "cl::location(...) not specified for a command "
1586 "line option with external storage!");
1587 Location->push_back(V);
1588 if (initial)
1589 Default.push_back(V);
1590 }
1591
1592 const std::vector<OptionValue> &getDefault() const {
1593 return Default;
1594 }
1595
1599};
1600
1601
1602
1603
1604
1605
1606
1607
1608
1610 std::vector Storage;
1611 std::vector<OptionValue> Default;
1612 bool DefaultAssigned = false;
1613
1614public:
1615 using iterator = typename std::vector::iterator;
1616
1619
1620 using const_iterator = typename std::vector::const_iterator;
1621
1624
1625 using size_type = typename std::vector::size_type;
1626
1628
1629 bool empty() const { return Storage.empty(); }
1630
1631 void push_back(const DataType &value) { Storage.push_back(value); }
1632 void push_back(DataType &&value) { Storage.push_back(value); }
1633
1634 using reference = typename std::vector::reference;
1635 using const_reference = typename std::vector::const_reference;
1636
1639
1641 Storage.clear();
1642 }
1643
1646 return Storage.erase(first, last);
1647 }
1648
1651 return Storage.erase(first, last);
1652 }
1653
1655 return Storage.insert(pos, value);
1656 }
1658 return Storage.insert(pos, value);
1659 }
1660
1662 return Storage.insert(pos, value);
1663 }
1665 return Storage.insert(pos, value);
1666 }
1667
1670
1671 operator std::vector &() { return Storage; }
1673 std::vector *operator&() { return &Storage; }
1674 const std::vector *operator&() const { return &Storage; }
1675
1676 template void addValue(const T &V, bool initial = false) {
1677 Storage.push_back(V);
1678 if (initial)
1680 }
1681
1682 const std::vector<OptionValue> &getDefault() const {
1683 return Default;
1684 }
1685
1689};
1690
1691
1692
1693
1695 class ParserClass = parser>
1697 std::vector Positions;
1698 ParserClass Parser;
1699
1700 enum ValueExpected getValueExpectedFlagDefault() const override {
1701 return Parser.getValueExpectedFlagDefault();
1702 }
1703
1705 return Parser.getExtraOptionNames(OptionNames);
1706 }
1707
1708 bool handleOccurrence(unsigned pos, StringRef ArgName,
1710 typename ParserClass::parser_data_type Val =
1711 typename ParserClass::parser_data_type();
1715 }
1716 if (Parser.parse(*this, ArgName, Arg, Val))
1717 return true;
1720 Positions.push_back(pos);
1722 return false;
1723 }
1724
1725
1727 return Parser.getOptionWidth(*this);
1728 }
1729
1730 void printOptionInfo(size_t GlobalWidth) const override {
1731 Parser.printOptionInfo(*this, GlobalWidth);
1732 }
1733
1734
1735 void printOptionValue(size_t , bool ) const override {
1736 }
1737
1739 Positions.clear();
1743 }
1744
1745 void done() {
1747 Parser.initialize();
1748 }
1749
1750public:
1751
1754
1756
1758 assert(optnum < this->size() && "Invalid option index");
1759 return Positions[optnum];
1760 }
1761
1763 Positions.clear();
1765 }
1766
1767
1770 "Cannot have two default values");
1772 for (auto &Val : Vs)
1774 }
1775
1777
1778 template <class... Mods>
1779 explicit list(const Mods &... Ms)
1781 apply(this, Ms...);
1782 done();
1783 }
1784
1786 std::function<void(const typename ParserClass::parser_data_type &)> CB) {
1788 }
1789
1790 std::function<void(const typename ParserClass::parser_data_type &)> Callback =
1791 [](const typename ParserClass::parser_data_type &) {};
1792};
1793
1794
1798
1799 template <typename D, typename S, typename P>
1803};
1804
1805
1806
1807
1808
1809
1810template <class DataType, class StorageClass> class bits_storage {
1811 unsigned *Location = nullptr;
1812
1813 template static unsigned Bit(const T &V) {
1814 unsigned BitPos = static_cast<unsigned>(V);
1815 assert(BitPos < sizeof(unsigned) * CHAR_BIT &&
1816 "enum exceeds width of bit vector!");
1817 return 1 << BitPos;
1818 }
1819
1820public:
1822
1824 if (Location)
1825 return O.error("cl::location(x) specified more than once!");
1826 Location = &L;
1827 return false;
1828 }
1829
1831 assert(Location != nullptr &&
1832 "cl::location(...) not specified for a command "
1833 "line option with external storage!");
1834 *Location |= Bit(V);
1835 }
1836
1837 unsigned getBits() { return *Location; }
1838
1840 if (Location)
1841 *Location = 0;
1842 }
1843
1844 template bool isSet(const T &V) {
1845 return (*Location & Bit(V)) != 0;
1846 }
1847};
1848
1849
1850
1851
1853 unsigned Bits{0};
1854
1855 template static unsigned Bit(const T &V) {
1856 unsigned BitPos = static_cast<unsigned>(V);
1857 assert(BitPos < sizeof(unsigned) * CHAR_BIT &&
1858 "enum exceeds width of bit vector!");
1859 return 1 << BitPos;
1860 }
1861
1862public:
1863 template void addValue(const T &V) { Bits |= Bit(V); }
1864
1866
1868
1869 template bool isSet(const T &V) { return (Bits & Bit(V)) != 0; }
1870};
1871
1872
1873
1874
1875template <class DataType, class Storage = bool,
1876 class ParserClass = parser>
1878 std::vector Positions;
1879 ParserClass Parser;
1880
1881 enum ValueExpected getValueExpectedFlagDefault() const override {
1882 return Parser.getValueExpectedFlagDefault();
1883 }
1884
1886 return Parser.getExtraOptionNames(OptionNames);
1887 }
1888
1889 bool handleOccurrence(unsigned pos, StringRef ArgName,
1891 typename ParserClass::parser_data_type Val =
1892 typename ParserClass::parser_data_type();
1893 if (Parser.parse(*this, ArgName, Arg, Val))
1894 return true;
1897 Positions.push_back(pos);
1899 return false;
1900 }
1901
1902
1904 return Parser.getOptionWidth(*this);
1905 }
1906
1907 void printOptionInfo(size_t GlobalWidth) const override {
1908 Parser.printOptionInfo(*this, GlobalWidth);
1909 }
1910
1911
1912 void printOptionValue(size_t , bool ) const override {
1913 }
1914
1916
1917 void done() {
1919 Parser.initialize();
1920 }
1921
1922public:
1923
1926
1928
1930 assert(optnum < this->size() && "Invalid option index");
1931 return Positions[optnum];
1932 }
1933
1934 template <class... Mods>
1935 explicit bits(const Mods &... Ms)
1937 apply(this, Ms...);
1938 done();
1939 }
1940
1942 std::function<void(const typename ParserClass::parser_data_type &)> CB) {
1944 }
1945
1946 std::function<void(const typename ParserClass::parser_data_type &)> Callback =
1947 [](const typename ParserClass::parser_data_type &) {};
1948};
1949
1950
1951
1952
1953
1956
1957 bool handleOccurrence(unsigned pos, StringRef ,
1959 return AliasFor->handleOccurrence(pos, AliasFor->ArgStr, Arg);
1960 }
1961
1962 bool addOccurrence(unsigned pos, StringRef , StringRef Value,
1963 bool MultiArg = false) override {
1964 return AliasFor->addOccurrence(pos, AliasFor->ArgStr, Value, MultiArg);
1965 }
1966
1967
1968 size_t getOptionWidth() const override;
1969 void printOptionInfo(size_t GlobalWidth) const override;
1970
1971
1972 void printOptionValue(size_t , bool ) const override {
1973 }
1974
1975 void setDefault() override { AliasFor->setDefault(); }
1976
1977 ValueExpected getValueExpectedFlagDefault() const override {
1978 return AliasFor->getValueExpectedFlag();
1979 }
1980
1981 void done() {
1983 error("cl::alias must have argument name specified!");
1984 if (!AliasFor)
1985 error("cl::alias must have an cl::aliasopt(option) specified!");
1986 if (.empty())
1987 error("cl::alias must not have cl::sub(), aliased option's cl::sub() will be used!");
1988 Subs = AliasFor->Subs;
1991 }
1992
1993public:
1994
1997
1999 if (AliasFor)
2000 error("cl::alias must only have one cl::aliasopt(...) specified!");
2001 AliasFor = &O;
2002 }
2003
2004 template <class... Mods>
2005 explicit alias(const Mods &... Ms)
2007 apply(this, Ms...);
2008 done();
2009 }
2010};
2011
2012
2020
2021
2022
2023
2029
2031
2032
2033
2034
2035
2036
2038
2039
2040
2041
2043
2044
2045
2046
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2123 bool MarkEOLs = false);
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2141 bool MarkEOLs = false);
2142
2143
2144
2145
2146
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2167 bool MarkEOLs = false);
2168
2169
2170
2173 bool MarkEOLs);
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2186 bool MarkEOLs = false);
2187
2188
2190
2192
2193
2195
2196
2198
2199
2200
2202
2203
2205
2206
2207
2208 bool RelativeNames = false;
2209
2210
2211
2212 bool MarkEOLs = false;
2213
2214
2215 bool InConfigFile = false;
2216
2219
2220public:
2223
2225 MarkEOLs = X;
2226 return *this;
2227 }
2228
2230 RelativeNames = X;
2231 return *this;
2232 }
2233
2235 CurrentDir = X;
2236 return *this;
2237 }
2238
2240 SearchDirs = X;
2241 return *this;
2242 }
2243
2245 FS = X;
2246 return *this;
2247 }
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2273
2274
2276};
2277
2278
2279
2280
2281
2283 const char *EnvVar,
2285
2286
2287
2291
2292
2293
2294
2295
2299
2300
2301
2302
2303
2304
2305
2306
2309
2310
2311
2312
2313
2314
2315
2316
2320
2321
2322
2323
2325
2326
2327
2328
2329
2331
2332
2334
2335}
2336
2337}
2338
2339#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMap class.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define LLVM_TEMPLATE_ABI
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - Represent a constant reference to a string, i.e.
std::string str() const
str - Get the contents as an std::string.
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
LLVM_ABI Value(Type *Ty, unsigned scid)
ExpansionContext & setCurrentDir(StringRef X)
Definition CommandLine.h:2234
LLVM_ABI ExpansionContext(BumpPtrAllocator &A, TokenizerCallback T, vfs::FileSystem *FS=nullptr)
ExpansionContext & setVFS(vfs::FileSystem *X)
Definition CommandLine.h:2244
ExpansionContext & setMarkEOLs(bool X)
Definition CommandLine.h:2224
ExpansionContext & setSearchDirs(ArrayRef< StringRef > X)
Definition CommandLine.h:2239
ExpansionContext & setRelativeNames(bool X)
Definition CommandLine.h:2229
LLVM_ABI bool findConfigFile(StringRef FileName, SmallVectorImpl< char > &FilePath)
Looks for the specified configuration file.
LLVM_ABI Error expandResponseFiles(SmallVectorImpl< const char * > &Argv)
Expands constructs "@file" in the provided array of arguments recursively.
LLVM_ABI Error readConfigFile(StringRef CfgFile, SmallVectorImpl< const char * > &Argv)
Reads command line options from the given configuration file.
Definition CommandLine.h:181
OptionCategory(StringRef const Name, StringRef const Description="")
Definition CommandLine.h:189
StringRef getDescription() const
Definition CommandLine.h:196
StringRef getName() const
Definition CommandLine.h:195
OptionValueCopy & operator=(const OptionValueCopy &)=default
bool hasValue() const
Definition CommandLine.h:587
OptionValueCopy()=default
bool compare(const GenericOptionValue &V) const override
Definition CommandLine.h:602
void setValue(const DataType &V)
Definition CommandLine.h:594
~OptionValueCopy()=default
const DataType & getValue() const
Definition CommandLine.h:589
OptionValueCopy(const OptionValueCopy &)=default
bool compare(const DataType &V) const
Definition CommandLine.h:600
Definition CommandLine.h:252
bool isPositional() const
Definition CommandLine.h:313
virtual void getExtraOptionNames(SmallVectorImpl< StringRef > &)
Definition CommandLine.h:388
void setValueExpectedFlag(enum ValueExpected Val)
Definition CommandLine.h:328
void setPosition(unsigned pos)
Definition CommandLine.h:332
bool isConsumeAfter() const
Definition CommandLine.h:317
StringRef ValueStr
Definition CommandLine.h:286
SmallPtrSet< SubCommand *, 1 > Subs
Definition CommandLine.h:289
StringRef ArgStr
Definition CommandLine.h:284
int getNumOccurrences() const
Definition CommandLine.h:401
friend class alias
Definition CommandLine.h:253
enum ValueExpected getValueExpectedFlag() const
Definition CommandLine.h:295
void setValueStr(StringRef S)
Definition CommandLine.h:326
void setNumOccurrencesFlag(enum NumOccurrencesFlag Val)
Definition CommandLine.h:327
void setNumAdditionalVals(unsigned n)
Definition CommandLine.h:345
void setDescription(StringRef S)
Definition CommandLine.h:325
void setFormattingFlag(enum FormattingFlags V)
Definition CommandLine.h:330
void setHiddenFlag(enum OptionHidden Val)
Definition CommandLine.h:329
void setMiscFlag(enum MiscFlags M)
Definition CommandLine.h:331
enum FormattingFlags getFormattingFlag() const
Definition CommandLine.h:303
virtual void printOptionInfo(size_t GlobalWidth) const =0
enum NumOccurrencesFlag getNumOccurrencesFlag() const
Definition CommandLine.h:291
SmallVector< OptionCategory *, 1 > Categories
Definition CommandLine.h:288
bool isSink() const
Definition CommandLine.h:314
void addSubCommand(SubCommand &S)
Definition CommandLine.h:334
bool hasArgStr() const
Definition CommandLine.h:312
bool isDefaultOption() const
Definition CommandLine.h:315
unsigned getMiscFlags() const
Definition CommandLine.h:307
virtual void setDefault()=0
virtual void printOptionValue(size_t GlobalWidth, bool Force) const =0
virtual ~Option()=default
static void printEnumValHelpStr(StringRef HelpStr, size_t Indent, size_t FirstLineIndentedBy)
unsigned getNumAdditionalVals() const
Definition CommandLine.h:309
void removeArgument()
Unregisters this option from the CommandLine system.
Option(enum NumOccurrencesFlag OccurrencesFlag, enum OptionHidden Hidden)
Definition CommandLine.h:337
enum OptionHidden getOptionHiddenFlag() const
Definition CommandLine.h:299
bool error(const Twine &Message, raw_ostream &Errs)
Definition CommandLine.h:397
static void printHelpStr(StringRef HelpStr, size_t Indent, size_t FirstLineIndentedBy)
virtual size_t getOptionWidth() const =0
StringRef HelpStr
Definition CommandLine.h:285
unsigned getPosition() const
Definition CommandLine.h:308
Definition CommandLine.h:241
SubCommandGroup(std::initializer_list< SubCommand * > IL)
Definition CommandLine.h:245
ArrayRef< SubCommand * > getSubCommands() const
Definition CommandLine.h:247
Definition CommandLine.h:204
StringRef getName() const
Definition CommandLine.h:231
SubCommand(StringRef Name, StringRef Description="")
Definition CommandLine.h:214
SmallVector< Option *, 4 > SinkOpts
Definition CommandLine.h:235
static LLVM_ABI SubCommand & getTopLevel()
LLVM_ABI void unregisterSubCommand()
static LLVM_ABI SubCommand & getAll()
LLVM_ABI void registerSubCommand()
Option * ConsumeAfterOpt
Definition CommandLine.h:238
SmallVector< Option *, 4 > PositionalOpts
Definition CommandLine.h:234
StringMap< Option * > OptionsMap
Definition CommandLine.h:236
StringRef getDescription() const
Definition CommandLine.h:232
Definition CommandLine.h:694
void apply(Opt &O) const
Definition CommandLine.h:704
ValuesClass(std::initializer_list< OptionEnumValue > Options)
Definition CommandLine.h:701
Definition CommandLine.h:1954
alias(const alias &)=delete
void setAliasFor(Option &O)
Definition CommandLine.h:1998
alias & operator=(const alias &)=delete
alias(const Mods &... Ms)
Definition CommandLine.h:2005
enum ValueExpected getValueExpectedFlagDefault() const
Definition CommandLine.h:902
void getExtraOptionNames(SmallVectorImpl< StringRef > &)
Definition CommandLine.h:906
virtual StringRef getValueName() const
Definition CommandLine.h:922
virtual ~basic_parser_impl()=default
basic_parser_impl(Option &)
Definition CommandLine.h:898
void initialize()
Definition CommandLine.h:908
Definition CommandLine.h:935
basic_parser(Option &O)
Definition CommandLine.h:940
OptionValue< DataType > OptVal
Definition CommandLine.h:938
DataType parser_data_type
Definition CommandLine.h:937
bool isSet(const T &V)
Definition CommandLine.h:1869
void addValue(const T &V)
Definition CommandLine.h:1863
unsigned getBits()
Definition CommandLine.h:1865
void clear()
Definition CommandLine.h:1867
unsigned getBits()
Definition CommandLine.h:1837
bool isSet(const T &V)
Definition CommandLine.h:1844
void addValue(const T &V)
Definition CommandLine.h:1830
void clear()
Definition CommandLine.h:1839
bool setLocation(Option &O, unsigned &L)
Definition CommandLine.h:1823
bits & operator=(const bits &)=delete
bits(const Mods &... Ms)
Definition CommandLine.h:1935
ParserClass & getParser()
Definition CommandLine.h:1927
unsigned getPosition(unsigned optnum) const
Definition CommandLine.h:1929
void setCallback(std::function< void(const typename ParserClass::parser_data_type &)> CB)
Definition CommandLine.h:1941
std::function< void(const typename ParserClass::parser_data_type &)> Callback
Definition CommandLine.h:1946
bits(const bits &)=delete
GenericOptionInfo(StringRef name, StringRef helpStr)
Definition CommandLine.h:733
StringRef Name
Definition CommandLine.h:735
StringRef HelpStr
Definition CommandLine.h:736
Definition CommandLine.h:729
virtual size_t getOptionWidth(const Option &O) const
generic_parser_base(Option &O)
Definition CommandLine.h:740
virtual StringRef getDescription(unsigned N) const =0
Option & Owner
Definition CommandLine.h:816
virtual const GenericOptionValue & getOptionValue(unsigned N) const =0
void initialize()
Definition CommandLine.h:781
virtual unsigned getNumOptions() const =0
virtual StringRef getOption(unsigned N) const =0
void printOptionDiff(const Option &O, const AnyOptionValue &V, const AnyOptionValue &Default, size_t GlobalWidth) const
Definition CommandLine.h:775
void printGenericOptionDiff(const Option &O, const GenericOptionValue &V, const GenericOptionValue &Default, size_t GlobalWidth) const
virtual void printOptionInfo(const Option &O, size_t GlobalWidth) const
unsigned findOption(StringRef Name)
virtual ~generic_parser_base()=default
void getExtraOptionNames(SmallVectorImpl< StringRef > &OptionNames)
Definition CommandLine.h:783
enum ValueExpected getValueExpectedFlagDefault() const
Definition CommandLine.h:792
void push_back(DataType &&value)
Definition CommandLine.h:1632
iterator end()
Definition CommandLine.h:1618
void clear()
Definition CommandLine.h:1640
void assignDefault()
Definition CommandLine.h:1686
iterator begin()
Definition CommandLine.h:1617
bool isDefaultAssigned()
Definition CommandLine.h:1688
typename std::vector< DataType >::const_iterator const_iterator
Definition CommandLine.h:1620
typename std::vector< DataType >::const_reference const_reference
Definition CommandLine.h:1635
const_iterator begin() const
Definition CommandLine.h:1622
iterator erase(const_iterator first, const_iterator last)
Definition CommandLine.h:1645
iterator insert(const_iterator pos, const DataType &value)
Definition CommandLine.h:1654
iterator erase(iterator first, iterator last)
Definition CommandLine.h:1650
const_reference operator[](size_type pos) const
Definition CommandLine.h:1638
bool empty() const
Definition CommandLine.h:1629
void addValue(const T &V, bool initial=false)
Definition CommandLine.h:1676
void push_back(const DataType &value)
Definition CommandLine.h:1631
typename std::vector< DataType >::reference reference
Definition CommandLine.h:1634
reference operator[](size_type pos)
Definition CommandLine.h:1637
void overwriteDefault()
Definition CommandLine.h:1687
const std::vector< DataType > * operator&() const
Definition CommandLine.h:1674
iterator insert(iterator pos, const DataType &value)
Definition CommandLine.h:1661
typename std::vector< DataType >::size_type size_type
Definition CommandLine.h:1625
const_reference front() const
Definition CommandLine.h:1669
const_iterator end() const
Definition CommandLine.h:1623
iterator insert(const_iterator pos, DataType &&value)
Definition CommandLine.h:1657
iterator erase(iterator pos)
Definition CommandLine.h:1649
std::vector< DataType > * operator&()
Definition CommandLine.h:1673
const std::vector< OptionValue< DataType > > & getDefault() const
Definition CommandLine.h:1682
iterator erase(const_iterator pos)
Definition CommandLine.h:1644
iterator insert(iterator pos, DataType &&value)
Definition CommandLine.h:1664
size_type size() const
Definition CommandLine.h:1627
typename std::vector< DataType >::iterator iterator
Definition CommandLine.h:1615
reference front()
Definition CommandLine.h:1668
const std::vector< OptionValue< DataType > > & getDefault() const
Definition CommandLine.h:1592
void overwriteDefault()
Definition CommandLine.h:1597
bool isDefaultAssigned()
Definition CommandLine.h:1598
void clear()
Definition CommandLine.h:1574
void addValue(const T &V, bool initial=false)
Definition CommandLine.h:1583
void assignDefault()
Definition CommandLine.h:1596
bool setLocation(Option &O, StorageClass &L)
Definition CommandLine.h:1576
Definition CommandLine.h:1696
list(const Mods &... Ms)
Definition CommandLine.h:1779
void setCallback(std::function< void(const typename ParserClass::parser_data_type &)> CB)
Definition CommandLine.h:1785
list(const list &)=delete
void setInitialValues(ArrayRef< DataType > Vs)
Definition CommandLine.h:1768
std::function< void(const typename ParserClass::parser_data_type &)> Callback
Definition CommandLine.h:1790
void clear()
Definition CommandLine.h:1762
list & operator=(const list &)=delete
ParserClass & getParser()
Definition CommandLine.h:1755
unsigned getPosition(unsigned optnum) const
Definition CommandLine.h:1757
void setNumAdditionalVals(unsigned n)
Definition CommandLine.h:1776
OptionValue< DataType > Default
Definition CommandLine.h:1426
DataType operator->() const
Definition CommandLine.h:1445
opt_storage()
Definition CommandLine.h:1430
const OptionValue< DataType > & getDefault() const
Definition CommandLine.h:1440
void setValue(const T &V, bool initial=false)
Definition CommandLine.h:1432
DataType & getValue()
Definition CommandLine.h:1437
DataType Value
Definition CommandLine.h:1425
DataType getValue() const
Definition CommandLine.h:1438
void setValue(const T &V, bool initial=false)
Definition CommandLine.h:1407
OptionValue< DataType > Default
Definition CommandLine.h:1405
DataType & getValue()
Definition CommandLine.h:1413
const DataType & getValue() const
Definition CommandLine.h:1414
const OptionValue< DataType > & getDefault() const
Definition CommandLine.h:1416
const DataType & getValue() const
Definition CommandLine.h:1388
bool setLocation(Option &O, DataType &L)
Definition CommandLine.h:1369
void setValue(const T &V, bool initial=false)
Definition CommandLine.h:1377
const OptionValue< DataType > & getDefault() const
Definition CommandLine.h:1395
DataType & getValue()
Definition CommandLine.h:1384
ParserClass & getParser()
Definition CommandLine.h:1517
opt & operator=(const opt &)=delete
void setInitialValue(const DataType &V)
Definition CommandLine.h:1515
void setCallback(std::function< void(const typename ParserClass::parser_data_type &)> CB)
Definition CommandLine.h:1538
DataType & operator=(const T &Val)
Definition CommandLine.h:1519
opt(const Mods &... Ms)
Definition CommandLine.h:1532
DataType & operator=(T &&Val)
Definition CommandLine.h:1525
std::function< void(const typename ParserClass::parser_data_type &)> Callback
Definition CommandLine.h:1543
Definition CommandLine.h:827
OptionInfo(StringRef name, DataType v, StringRef helpStr)
Definition CommandLine.h:829
OptionValue< DataType > V
Definition CommandLine.h:832
bool parse(Option &O, StringRef ArgName, StringRef Arg, boolOrDefault &Val)
void printOptionDiff(const Option &O, boolOrDefault V, OptVal Default, size_t GlobalWidth) const
parser(Option &O)
Definition CommandLine.h:977
StringRef getValueName() const override
Definition CommandLine.h:987
enum ValueExpected getValueExpectedFlagDefault() const
Definition CommandLine.h:982
parser(Option &O)
Definition CommandLine.h:949
enum ValueExpected getValueExpectedFlagDefault() const
Definition CommandLine.h:956
void printOptionDiff(const Option &O, bool V, OptVal Default, size_t GlobalWidth) const
bool parse(Option &O, StringRef ArgName, StringRef Arg, bool &Val)
StringRef getValueName() const override
Definition CommandLine.h:961
void initialize()
Definition CommandLine.h:954
bool parse(Option &, StringRef, StringRef Arg, char &Value)
Definition CommandLine.h:1228
void printOptionDiff(const Option &O, char V, OptVal Default, size_t GlobalWidth) const
StringRef getValueName() const override
Definition CommandLine.h:1234
parser(Option &O)
Definition CommandLine.h:1225
void printOptionDiff(const Option &O, double V, OptVal Default, size_t GlobalWidth) const
parser(Option &O)
Definition CommandLine.h:1133
StringRef getValueName() const override
Definition CommandLine.h:1139
bool parse(Option &O, StringRef ArgName, StringRef Arg, double &Val)
bool parse(Option &O, StringRef ArgName, StringRef Arg, float &Val)
StringRef getValueName() const override
Definition CommandLine.h:1160
void printOptionDiff(const Option &O, float V, OptVal Default, size_t GlobalWidth) const
parser(Option &O)
Definition CommandLine.h:1154
StringRef getValueName() const override
Definition CommandLine.h:1008
void printOptionDiff(const Option &O, int V, OptVal Default, size_t GlobalWidth) const
bool parse(Option &O, StringRef ArgName, StringRef Arg, int &Val)
parser(Option &O)
Definition CommandLine.h:1002
StringRef getValueName() const override
Definition CommandLine.h:1029
bool parse(Option &O, StringRef ArgName, StringRef Arg, long &Val)
parser(Option &O)
Definition CommandLine.h:1023
void printOptionDiff(const Option &O, long V, OptVal Default, size_t GlobalWidth) const
bool parse(Option &O, StringRef ArgName, StringRef Arg, long long &Val)
StringRef getValueName() const override
Definition CommandLine.h:1050
void printOptionDiff(const Option &O, long long V, OptVal Default, size_t GlobalWidth) const
parser(Option &O)
Definition CommandLine.h:1044
void printOptionDiff(const Option &O, std::optional< StringRef > V, const OptVal &Default, size_t GlobalWidth) const
bool parse(Option &, StringRef, StringRef Arg, std::optional< std::string > &Value)
Definition CommandLine.h:1203
StringRef getValueName() const override
Definition CommandLine.h:1210
parser(Option &O)
Definition CommandLine.h:1200
parser(Option &O)
Definition CommandLine.h:1176
StringRef getValueName() const override
Definition CommandLine.h:1185
void printOptionDiff(const Option &O, StringRef V, const OptVal &Default, size_t GlobalWidth) const
bool parse(Option &, StringRef, StringRef Arg, std::string &Value)
Definition CommandLine.h:1179
bool parse(Option &O, StringRef ArgName, StringRef Arg, unsigned &Val)
void printOptionDiff(const Option &O, unsigned V, OptVal Default, size_t GlobalWidth) const
StringRef getValueName() const override
Definition CommandLine.h:1071
parser(Option &O)
Definition CommandLine.h:1065
StringRef getValueName() const override
Definition CommandLine.h:1094
void printOptionDiff(const Option &O, unsigned long V, OptVal Default, size_t GlobalWidth) const
bool parse(Option &O, StringRef ArgName, StringRef Arg, unsigned long &Val)
parser(Option &O)
Definition CommandLine.h:1088
StringRef getValueName() const override
Definition CommandLine.h:1118
parser(Option &O)
Definition CommandLine.h:1111
void printOptionDiff(const Option &O, unsigned long long V, OptVal Default, size_t GlobalWidth) const
bool parse(Option &O, StringRef ArgName, StringRef Arg, unsigned long long &Val)
Definition CommandLine.h:825
DataType parser_data_type
Definition CommandLine.h:839
SmallVector< OptionInfo, 8 > Values
Definition CommandLine.h:834
parser(Option &O)
Definition CommandLine.h:837
void removeLiteralOption(StringRef Name)
Remove the specified option.
Definition CommandLine.h:885
StringRef getDescription(unsigned N) const override
Definition CommandLine.h:844
void addLiteralOption(StringRef Name, const DT &V, StringRef HelpStr)
Add an entry to the mapping table.
Definition CommandLine.h:873
const GenericOptionValue & getOptionValue(unsigned N) const override
Definition CommandLine.h:849
StringRef getOption(unsigned N) const override
Definition CommandLine.h:843
bool parse(Option &O, StringRef ArgName, StringRef Arg, DataType &V)
Definition CommandLine.h:854
unsigned getNumOptions() const override
Definition CommandLine.h:842
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
The virtual file system interface.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
This namespace contains all of the command line option processing machinery.
Definition CommandLine.h:53
LLVM_ABI iterator_range< SmallPtrSet< SubCommand *, 4 >::iterator > getRegisteredSubcommands()
Use this to get all registered SubCommands from the provided parser.
LLVM_ABI void PrintVersionMessage()
Utility function for printing version number.
LLVM_ABI bool ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer, SmallVectorImpl< const char * > &Argv)
A convenience helper which supports the typical use case of expansion function call.
LLVM_ABI void TokenizeWindowsCommandLine(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false)
Tokenizes a string of Windows command line arguments, which may contain quotes and escaped quotes.
list_initializer< Ty > list_init(ArrayRef< Ty > Vals)
Definition CommandLine.h:450
LLVM_ABI OptionCategory & getGeneralCategory()
NumOccurrencesFlag
Definition CommandLine.h:114
@ ConsumeAfter
Definition CommandLine.h:127
@ ZeroOrMore
Definition CommandLine.h:116
@ Optional
Definition CommandLine.h:115
@ OneOrMore
Definition CommandLine.h:118
@ Required
Definition CommandLine.h:117
ValueExpected
Definition CommandLine.h:130
@ ValueOptional
Definition CommandLine.h:132
@ ValueDisallowed
Definition CommandLine.h:134
@ ValueRequired
Definition CommandLine.h:133
LLVM_ABI void ResetAllOptionOccurrences()
Reset all command line options to a state that looks as if they have never appeared on the command li...
LLVM_ABI void SetVersionPrinter(VersionPrinterTy func)
===------------------------------------------------------------------—===// Override the default (LLV...
LLVM_ABI void tokenizeConfigFile(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false)
Tokenizes content of configuration file.
OptionHidden
Definition CommandLine.h:137
@ Hidden
Definition CommandLine.h:139
@ NotHidden
Definition CommandLine.h:138
@ ReallyHidden
Definition CommandLine.h:140
LLVM_ABI StringMap< Option * > & getRegisteredOptions(SubCommand &Sub=SubCommand::getTopLevel())
Use this to get a StringMap to all registered named options (e.g.
LLVM_ABI void ResetCommandLineParser()
Reset the command line parser back to its initial state.
LLVM_ABI void PrintOptionValues()
void apply(Opt *O, const Mod &M, const Mods &... Ms)
Definition CommandLine.h:1341
LLVM_ABI void AddLiteralOption(Option &O, StringRef Name)
Adds a new option for parsing and provides the option it refers to.
void printOptionDiff(const Option &O, const generic_parser_base &P, const DT &V, const OptionValue< DT > &Default, size_t GlobalWidth)
Definition CommandLine.h:1249
LLVM_ABI void TokenizeWindowsCommandLineNoCopy(StringRef Source, StringSaver &Saver, SmallVectorImpl< StringRef > &NewArgv)
Tokenizes a Windows command line while attempting to avoid copies.
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
Definition CommandLine.h:713
boolOrDefault
Definition CommandLine.h:639
@ BOU_FALSE
Definition CommandLine.h:639
@ BOU_UNSET
Definition CommandLine.h:639
@ BOU_TRUE
Definition CommandLine.h:639
template class LLVM_TEMPLATE_ABI basic_parser< bool >
LLVM_ABI void printBuildConfig(raw_ostream &OS)
Prints the compiler build configuration.
void(*)(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs) TokenizerCallback
String tokenization function type.
Definition CommandLine.h:2171
LLVM_ABI bool ProvidePositionalOption(Option *Handler, StringRef Arg, int i)
Parses Arg into the option handler Handler.
LLVM_ABI bool expandResponseFiles(int Argc, const char *const *Argv, const char *EnvVar, SmallVectorImpl< const char * > &NewArgv)
A convenience helper which concatenates the options specified by the environment variable EnvVar and ...
initializer< Ty > init(const Ty &Val)
Definition CommandLine.h:445
std::function< void(raw_ostream &)> VersionPrinterTy
Definition CommandLine.h:77
MiscFlags
Definition CommandLine.h:164
@ Sink
Definition CommandLine.h:167
@ CommaSeparated
Definition CommandLine.h:165
@ Grouping
Definition CommandLine.h:173
@ DefaultOption
Definition CommandLine.h:176
@ PositionalEatsArgs
Definition CommandLine.h:166
LLVM_ABI ArrayRef< StringRef > getCompilerBuildConfig()
An array of optional enabled settings in the LLVM build configuration, which may be of interest to co...
LocationClass< Ty > location(Ty &L)
Definition CommandLine.h:465
cb< typename detail::callback_traits< F >::result_type, typename detail::callback_traits< F >::arg_type > callback(F CB)
Definition CommandLine.h:525
LLVM_ABI void HideUnrelatedOptions(cl::OptionCategory &Category, SubCommand &Sub=SubCommand::getTopLevel())
Mark all options not part of this category as cl::ReallyHidden.
LLVM_ABI void AddExtraVersionPrinter(VersionPrinterTy func)
===------------------------------------------------------------------—===// Add an extra printer to u...
LLVM_ABI void PrintHelpMessage(bool Hidden=false, bool Categorized=false)
This function just prints the help message, exactly the same way as if the -help or -help-hidden opti...
LLVM_ABI void TokenizeWindowsCommandLineFull(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false)
Tokenizes a Windows full command line, including command name at the start.
LLVM_ABI bool ParseCommandLineOptions(int argc, const char *const *argv, StringRef Overview="", raw_ostream *Errs=nullptr, vfs::FileSystem *VFS=nullptr, const char *EnvVar=nullptr, bool LongOptionsUseDoubleDash=false)
FormattingFlags
Definition CommandLine.h:157
@ NormalFormatting
Definition CommandLine.h:158
@ Positional
Definition CommandLine.h:159
@ Prefix
Definition CommandLine.h:160
@ AlwaysPrefix
Definition CommandLine.h:161
LLVM_ABI void TokenizeGNUCommandLine(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false)
Tokenizes a command line that can contain escapes and quotes.
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
@ Mod
The access may modify the value stored in memory.
@ Sub
Subtraction of integers.
ArrayRef(const T &OneElt) -> ArrayRef< T >
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
@ Default
The result values are uniform if and only if all operands are uniform.
Implement std::hash so that hash_code can be used in STL containers.
Definition CommandLine.h:534
GenericOptionValue()=default
GenericOptionValue(const GenericOptionValue &)=default
GenericOptionValue & operator=(const GenericOptionValue &)=default
~GenericOptionValue()=default
virtual bool compare(const GenericOptionValue &V) const =0
Definition CommandLine.h:457
Ty & Loc
Definition CommandLine.h:458
void apply(Opt &O) const
Definition CommandLine.h:462
LocationClass(Ty &L)
Definition CommandLine.h:460
void print(const Option &O, const parser< DT > &P, const DT &V, const OptionValue< DT > &Default, size_t GlobalWidth)
Definition CommandLine.h:1267
Definition CommandLine.h:1257
void print(const Option &O, const parser< ParserDT > &P, const ValDT &, const OptionValue< ValDT > &, size_t GlobalWidth)
Definition CommandLine.h:1258
Definition CommandLine.h:680
int Value
Definition CommandLine.h:682
StringRef Description
Definition CommandLine.h:683
StringRef Name
Definition CommandLine.h:681
~OptionValueBase()=default
OptionValueBase & operator=(const OptionValueBase &)=default
OptionValueBase(const OptionValueBase &)=default
DataType WrapperType
Definition CommandLine.h:614
OptionValueBase()=default
Definition CommandLine.h:552
bool compare(const DataType &) const
Definition CommandLine.h:564
const DataType & getValue() const
Definition CommandLine.h:558
bool hasValue() const
Definition CommandLine.h:556
~OptionValueBase()=default
bool compare(const GenericOptionValue &) const override
Definition CommandLine.h:566
OptionValue< DataType > WrapperType
Definition CommandLine.h:554
void setValue(const DT &)
Definition CommandLine.h:561
OptionValue< cl::boolOrDefault > & operator=(const cl::boolOrDefault &V)
Definition CommandLine.h:649
OptionValue(const cl::boolOrDefault &V)
Definition CommandLine.h:647
cl::boolOrDefault WrapperType
Definition CommandLine.h:643
OptionValue< std::string > & operator=(const std::string &V)
Definition CommandLine.h:666
StringRef WrapperType
Definition CommandLine.h:660
OptionValue(const std::string &V)
Definition CommandLine.h:664
Definition CommandLine.h:626
OptionValue(const DataType &V)
Definition CommandLine.h:629
OptionValue< DataType > & operator=(const DT &V)
Definition CommandLine.h:632
void apply(alias &A) const
Definition CommandLine.h:2018
Option & Opt
Definition CommandLine.h:2014
aliasopt(Option &O)
Definition CommandLine.h:2016
static void opt(FormattingFlags FF, Option &O)
Definition CommandLine.h:1328
static void opt(MiscFlags MF, Option &O)
Definition CommandLine.h:1332
static void opt(NumOccurrencesFlag N, Option &O)
Definition CommandLine.h:1314
static void opt(StringRef Str, Opt &O)
Definition CommandLine.h:1308
static void opt(ValueExpected VE, Option &O)
Definition CommandLine.h:1320
static void opt(StringRef Str, Opt &O)
Definition CommandLine.h:1298
static void opt(StringRef Str, Opt &O)
Definition CommandLine.h:1303
Definition CommandLine.h:1292
static void opt(const Mod &M, Opt &O)
Definition CommandLine.h:1293
void apply(Opt &O) const
Definition CommandLine.h:475
cat(OptionCategory &c)
Definition CommandLine.h:473
OptionCategory & Category
Definition CommandLine.h:471
Definition CommandLine.h:497
void apply(Opt &O) const
Definition CommandLine.h:502
cb(std::function< R(Ty)> CB)
Definition CommandLine.h:500
std::function< R(Ty)> CB
Definition CommandLine.h:498
desc(StringRef Str)
Definition CommandLine.h:414
void apply(Option &O) const
Definition CommandLine.h:416
StringRef Desc
Definition CommandLine.h:412
R result_type
Definition CommandLine.h:511
std::tuple_element_t< 0, std::tuple< Args... > > arg_type
Definition CommandLine.h:512
Definition CommandLine.h:507
Definition CommandLine.h:431
const Ty & Init
Definition CommandLine.h:432
initializer(const Ty &Val)
Definition CommandLine.h:433
void apply(Opt &O) const
Definition CommandLine.h:435
Definition CommandLine.h:438
list_initializer(ArrayRef< Ty > Vals)
Definition CommandLine.h:440
ArrayRef< Ty > Inits
Definition CommandLine.h:439
void apply(Opt &O) const
Definition CommandLine.h:442
unsigned AdditionalVals
Definition CommandLine.h:1796
multi_val(unsigned N)
Definition CommandLine.h:1797
void apply(list< D, S, P > &L) const
Definition CommandLine.h:1800
sub(SubCommand &S)
Definition CommandLine.h:483
SubCommand * Sub
Definition CommandLine.h:480
sub(SubCommandGroup &G)
Definition CommandLine.h:484
void apply(Opt &O) const
Definition CommandLine.h:486
SubCommandGroup * Group
Definition CommandLine.h:481
StringRef Desc
Definition CommandLine.h:421
void apply(Option &O) const
Definition CommandLine.h:425
value_desc(StringRef Str)
Definition CommandLine.h:423