From 42f2a6b41ea62d4ccd10a6c469b27549881a7406 Mon Sep 17 00:00:00 2001 From: Jakub Staszak Date: Mon, 4 Nov 2013 19:22:50 +0000 Subject: Use startswith_lower() where possible. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194007 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Option/OptTable.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'lib/Option') diff --git a/lib/Option/OptTable.cpp b/lib/Option/OptTable.cpp index 78c5ea2..6fa459a 100644 --- a/lib/Option/OptTable.cpp +++ b/lib/Option/OptTable.cpp @@ -175,13 +175,6 @@ static bool isInput(const llvm::StringSet<> &Prefixes, StringRef Arg) { 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 OptTable::Info *I, StringRef Str, 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(); -- cgit v1.1