const char *getArgString(unsigned Index) const { return ArgStrings[Index]; }
/// hasArg - Does the arg list contain any option matching \arg Id.
- bool hasArg(options::ID Id) const;
+ bool hasArg(options::ID Id) const { return getLastArg(Id) != 0; }
+
+ /// getLastArg - Return the last argument matching \arg Id, or null.
+ Arg *getLastArg(options::ID Id) const;
};
} // end namespace driver
} // end namespace clang
Args.push_back(A);
}
-bool ArgList::hasArg(options::ID Id) const {
+Arg *ArgList::getLastArg(options::ID Id) const {
// FIXME: Make search efficient?
// FIXME: This needs to not require loading of the option.
for (const_iterator it = begin(), ie = end(); it != ie; ++it)
if ((*it)->getOption().matches(Id))
- return true;
+ return *it;
- return false;
+ return 0;
}