aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Option
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Option')
-rw-r--r--lib/Option/Arg.cpp25
-rw-r--r--lib/Option/ArgList.cpp34
-rw-r--r--lib/Option/OptTable.cpp14
-rw-r--r--lib/Option/Option.cpp3
4 files changed, 41 insertions, 35 deletions
diff --git a/lib/Option/Arg.cpp b/lib/Option/Arg.cpp
index af632d6..ac00073 100644
--- a/lib/Option/Arg.cpp
+++ b/lib/Option/Arg.cpp
@@ -17,22 +17,21 @@
using namespace llvm;
using namespace llvm::opt;
-Arg::Arg(const Option _Opt, StringRef S, unsigned _Index, const Arg *_BaseArg)
- : Opt(_Opt), BaseArg(_BaseArg), Spelling(S), Index(_Index),
- Claimed(false), OwnsValues(false) {
-}
-
-Arg::Arg(const Option _Opt, StringRef S, unsigned _Index,
- const char *Value0, const Arg *_BaseArg)
- : Opt(_Opt), BaseArg(_BaseArg), Spelling(S), Index(_Index),
- Claimed(false), OwnsValues(false) {
+Arg::Arg(const Option Opt, StringRef S, unsigned Index, const Arg *BaseArg)
+ : Opt(Opt), BaseArg(BaseArg), Spelling(S), Index(Index), Claimed(false),
+ OwnsValues(false) {}
+
+Arg::Arg(const Option Opt, StringRef S, unsigned Index, const char *Value0,
+ const Arg *BaseArg)
+ : Opt(Opt), BaseArg(BaseArg), Spelling(S), Index(Index), Claimed(false),
+ OwnsValues(false) {
Values.push_back(Value0);
}
-Arg::Arg(const Option _Opt, StringRef S, unsigned _Index,
- const char *Value0, const char *Value1, const Arg *_BaseArg)
- : Opt(_Opt), BaseArg(_BaseArg), Spelling(S), Index(_Index),
- Claimed(false), OwnsValues(false) {
+Arg::Arg(const Option Opt, StringRef S, unsigned Index, const char *Value0,
+ const char *Value1, const Arg *BaseArg)
+ : Opt(Opt), BaseArg(BaseArg), Spelling(S), Index(Index), Claimed(false),
+ OwnsValues(false) {
Values.push_back(Value0);
Values.push_back(Value1);
}
diff --git a/lib/Option/ArgList.cpp b/lib/Option/ArgList.cpp
index 85e956f..4bc8f92 100644
--- a/lib/Option/ArgList.cpp
+++ b/lib/Option/ArgList.cpp
@@ -63,6 +63,26 @@ Arg *ArgList::getLastArgNoClaim(OptSpecifier Id0, OptSpecifier Id1) const {
return nullptr;
}
+Arg *ArgList::getLastArgNoClaim(OptSpecifier Id0, OptSpecifier Id1,
+ OptSpecifier Id2) const {
+ // FIXME: Make search efficient?
+ for (const_reverse_iterator it = rbegin(), ie = rend(); it != ie; ++it)
+ if ((*it)->getOption().matches(Id0) || (*it)->getOption().matches(Id1) ||
+ (*it)->getOption().matches(Id2))
+ return *it;
+ return nullptr;
+}
+
+Arg *ArgList::getLastArgNoClaim(OptSpecifier Id0, OptSpecifier Id1,
+ OptSpecifier Id2, OptSpecifier Id3) const {
+ // FIXME: Make search efficient?
+ for (const_reverse_iterator it = rbegin(), ie = rend(); it != ie; ++it)
+ if ((*it)->getOption().matches(Id0) || (*it)->getOption().matches(Id1) ||
+ (*it)->getOption().matches(Id2) || (*it)->getOption().matches(Id3))
+ return *it;
+ return nullptr;
+}
+
Arg *ArgList::getLastArg(OptSpecifier Id) const {
Arg *Res = nullptr;
for (const_iterator it = begin(), ie = end(); it != ie; ++it) {
@@ -285,11 +305,6 @@ void ArgList::ClaimAllArgs() const {
(*it)->claim();
}
-const char *ArgList::MakeArgString(const Twine &T) const {
- SmallString<256> Str;
- return MakeArgString(T.toStringRef(Str));
-}
-
const char *ArgList::GetOrMakeJoinedArgString(unsigned Index,
StringRef LHS,
StringRef RHS) const {
@@ -334,19 +349,18 @@ unsigned InputArgList::MakeIndex(StringRef String0,
return Index0;
}
-const char *InputArgList::MakeArgString(StringRef Str) const {
+const char *InputArgList::MakeArgStringRef(StringRef Str) const {
return getArgString(MakeIndex(Str));
}
//
-DerivedArgList::DerivedArgList(const InputArgList &_BaseArgs)
- : BaseArgs(_BaseArgs) {
-}
+DerivedArgList::DerivedArgList(const InputArgList &BaseArgs)
+ : BaseArgs(BaseArgs) {}
DerivedArgList::~DerivedArgList() {}
-const char *DerivedArgList::MakeArgString(StringRef Str) const {
+const char *DerivedArgList::MakeArgStringRef(StringRef Str) const {
return BaseArgs.MakeArgString(Str);
}
diff --git a/lib/Option/OptTable.cpp b/lib/Option/OptTable.cpp
index dca02c1..96ba183 100644
--- a/lib/Option/OptTable.cpp
+++ b/lib/Option/OptTable.cpp
@@ -84,15 +84,11 @@ 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(const Info *OptionInfos, unsigned NumOptionInfos,
+ bool IgnoreCase)
+ : OptionInfos(OptionInfos), NumOptionInfos(NumOptionInfos),
+ 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.
diff --git a/lib/Option/Option.cpp b/lib/Option/Option.cpp
index cdc63c3..e29d649 100644
--- a/lib/Option/Option.cpp
+++ b/lib/Option/Option.cpp
@@ -35,9 +35,6 @@ Option::Option(const OptTable::Info *info, const OptTable *owner)
}
}
-Option::~Option() {
-}
-
void Option::dump() const {
llvm::errs() << "<";
switch (getKind()) {