mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[Option] Use an ArrayRef to store the Option Infos in OptTable. NFC
llvm-svn: 250901
This commit is contained in:
parent
34ef13aeba
commit
4da1f0e50a
@ -50,8 +50,7 @@ public:
|
||||
|
||||
private:
|
||||
/// \brief The static option information table.
|
||||
const Info *OptionInfos;
|
||||
unsigned NumOptionInfos;
|
||||
ArrayRef<Info> OptionInfos;
|
||||
bool IgnoreCase;
|
||||
|
||||
unsigned TheInputOptionID;
|
||||
@ -74,14 +73,13 @@ private:
|
||||
}
|
||||
|
||||
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.
|
||||
|
@ -51,7 +51,7 @@ static const llvm::opt::OptTable::Info infoTable[] = {
|
||||
|
||||
class LibOptTable : public llvm::opt::OptTable {
|
||||
public:
|
||||
LibOptTable() : OptTable(infoTable, llvm::array_lengthof(infoTable), true) {}
|
||||
LibOptTable() : OptTable(infoTable, true) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -84,11 +84,9 @@ static inline bool operator<(const OptTable::Info &I, const char *Name) {
|
||||
|
||||
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.
|
||||
|
||||
@ -199,8 +197,8 @@ Arg *OptTable::ParseOneArg(const ArgList &Args, unsigned &Index,
|
||||
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.
|
||||
|
@ -48,7 +48,7 @@ namespace {
|
||||
class TestOptTable : public OptTable {
|
||||
public:
|
||||
TestOptTable(bool IgnoreCase = false)
|
||||
: OptTable(InfoTable, array_lengthof(InfoTable), IgnoreCase) {}
|
||||
: OptTable(InfoTable, IgnoreCase) {}
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user