[llvm] r194007 - Use startswith_lower() where possible.
Jakub Staszak
kubastaszak at gmail.com
Mon Nov 4 11:22:51 PST 2013
Author: kuba
Date: Mon Nov 4 13:22:50 2013
New Revision: 194007
URL: http://llvm.org/viewvc/llvm-project?rev=194007&view=rev
Log:
Use startswith_lower() where possible.
Modified:
llvm/trunk/lib/Option/OptTable.cpp
llvm/trunk/tools/bugpoint/ToolRunner.cpp
Modified: llvm/trunk/lib/Option/OptTable.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Option/OptTable.cpp?rev=194007&r1=194006&r2=194007&view=diff
==============================================================================
--- llvm/trunk/lib/Option/OptTable.cpp (original)
+++ llvm/trunk/lib/Option/OptTable.cpp Mon Nov 4 13:22:50 2013
@@ -175,13 +175,6 @@ static bool isInput(const llvm::StringSe
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) {
@@ -190,7 +183,7 @@ static unsigned matchOption(const OptTab
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();
Modified: llvm/trunk/tools/bugpoint/ToolRunner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ToolRunner.cpp?rev=194007&r1=194006&r2=194007&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/ToolRunner.cpp (original)
+++ llvm/trunk/tools/bugpoint/ToolRunner.cpp Mon Nov 4 13:22:50 2013
@@ -662,7 +662,7 @@ static bool IsARMArchitecture(std::vecto
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;
}
}
More information about the llvm-commits
mailing list