return true;
}
-// Returns true if X starts with Y, ignoring case.
-static bool startsWithIgnoreCase(StringRef X, StringRef Y) {
- if (X.size() < Y.size())
- return false;
- return X.substr(0, Y.size()).equals_lower(Y);
-}
-
/// \returns Matched size. 0 means no match.
static unsigned matchOption(const OptTable::Info *I, StringRef Str,
bool IgnoreCase) {
if (Str.startswith(Prefix)) {
StringRef Rest = Str.substr(Prefix.size());
bool Matched = IgnoreCase
- ? startsWithIgnoreCase(Rest, I->Name)
+ ? Rest.startswith_lower(I->Name)
: Rest.startswith(I->Name);
if (Matched)
return Prefix.size() + StringRef(I->Name).size();
I = Args.begin(), E = Args.end(); I != E; ++I) {
if (StringRef(*I).equals_lower("-arch")) {
++I;
- if (I != E && StringRef(*I).substr(0, strlen("arm")).equals_lower("arm"))
+ if (I != E && StringRef(*I).startswith_lower("arm"))
return true;
}
}