/// negation is present, and \arg Default if neither option is
/// given. If both the option and its negation are present, the
/// last one wins.
- bool hasFlag(options::ID Pos, options::ID Neg, bool Default) const;
+ bool hasFlag(options::ID Pos, options::ID Neg, bool Default=true) const;
/// AddLastArg - Render only the last argument match \arg Id0, if
/// present.
}
bool ArgList::hasFlag(options::ID Pos, options::ID Neg, bool Default) const {
- Arg *PosA = getLastArg(Pos);
- Arg *NegA = getLastArg(Neg);
- if (PosA && NegA)
- return NegA->getIndex() < PosA->getIndex();
- if (PosA) return true;
- if (NegA) return false;
+ if (Arg *A = getLastArg(Pos, Neg))
+ return A->getOption().matches(Pos);
return Default;
}