mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
Use startswith_lower() where possible.
llvm-svn: 194007
This commit is contained in:
parent
02e4f56c18
commit
a0334b429e
@ -175,13 +175,6 @@ static bool isInput(const llvm::StringSet<> &Prefixes, StringRef Arg) {
|
|||||||
return true;
|
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.
|
/// \returns Matched size. 0 means no match.
|
||||||
static unsigned matchOption(const OptTable::Info *I, StringRef Str,
|
static unsigned matchOption(const OptTable::Info *I, StringRef Str,
|
||||||
bool IgnoreCase) {
|
bool IgnoreCase) {
|
||||||
@ -190,7 +183,7 @@ static unsigned matchOption(const OptTable::Info *I, StringRef Str,
|
|||||||
if (Str.startswith(Prefix)) {
|
if (Str.startswith(Prefix)) {
|
||||||
StringRef Rest = Str.substr(Prefix.size());
|
StringRef Rest = Str.substr(Prefix.size());
|
||||||
bool Matched = IgnoreCase
|
bool Matched = IgnoreCase
|
||||||
? startsWithIgnoreCase(Rest, I->Name)
|
? Rest.startswith_lower(I->Name)
|
||||||
: Rest.startswith(I->Name);
|
: Rest.startswith(I->Name);
|
||||||
if (Matched)
|
if (Matched)
|
||||||
return Prefix.size() + StringRef(I->Name).size();
|
return Prefix.size() + StringRef(I->Name).size();
|
||||||
|
@ -662,7 +662,7 @@ static bool IsARMArchitecture(std::vector<const char*> Args) {
|
|||||||
I = Args.begin(), E = Args.end(); I != E; ++I) {
|
I = Args.begin(), E = Args.end(); I != E; ++I) {
|
||||||
if (StringRef(*I).equals_lower("-arch")) {
|
if (StringRef(*I).equals_lower("-arch")) {
|
||||||
++I;
|
++I;
|
||||||
if (I != E && StringRef(*I).substr(0, strlen("arm")).equals_lower("arm"))
|
if (I != E && StringRef(*I).startswith_lower("arm"))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user