private:
/// \brief The static option information table.
- const Info *OptionInfos;
- unsigned NumOptionInfos;
+ ArrayRef<Info> OptionInfos;
bool IgnoreCase;
unsigned TheInputOptionID;
}
protected:
- OptTable(const Info *OptionInfos, unsigned NumOptionInfos,
- bool IgnoreCase = false);
+ OptTable(ArrayRef<Info> OptionInfos, bool IgnoreCase = false);
public:
~OptTable();
/// \brief Return the total number of option classes.
- unsigned getNumOptions() const { return NumOptionInfos; }
+ unsigned getNumOptions() const { return OptionInfos.size(); }
/// \brief Get the given Opt's Option instance, lazily creating it
/// if necessary.
OptSpecifier::OptSpecifier(const Option *Opt) : ID(Opt->getID()) {}
-OptTable::OptTable(const Info *OptionInfos, unsigned NumOptionInfos,
- bool IgnoreCase)
- : OptionInfos(OptionInfos), NumOptionInfos(NumOptionInfos),
- IgnoreCase(IgnoreCase), TheInputOptionID(0), TheUnknownOptionID(0),
- FirstSearchableIndex(0) {
+OptTable::OptTable(ArrayRef<Info> OptionInfos, bool IgnoreCase)
+ : OptionInfos(OptionInfos), IgnoreCase(IgnoreCase), TheInputOptionID(0),
+ TheUnknownOptionID(0), FirstSearchableIndex(0) {
// Explicitly zero initialize the error to work around a bug in array
// value-initialization on MinGW with gcc 4.3.5.
if (isInput(PrefixesUnion, Str))
return new Arg(getOption(TheInputOptionID), Str, Index++, Str);
- const Info *Start = OptionInfos + FirstSearchableIndex;
- const Info *End = OptionInfos + getNumOptions();
+ const Info *Start = OptionInfos.begin() + FirstSearchableIndex;
+ const Info *End = OptionInfos.end();
StringRef Name = StringRef(Str).ltrim(PrefixChars);
// Search for the first next option which could be a prefix.
class TestOptTable : public OptTable {
public:
TestOptTable(bool IgnoreCase = false)
- : OptTable(InfoTable, array_lengthof(InfoTable), IgnoreCase) {}
+ : OptTable(InfoTable, IgnoreCase) {}
};
}