diff options
author | Michael Zolotukhin <mzolotukhin@apple.com> | 2015-03-02 20:50:08 +0000 |
---|---|---|
committer | Michael Zolotukhin <mzolotukhin@apple.com> | 2015-03-02 20:50:08 +0000 |
commit | d3b76a3b019d4a006350a6cb979b426703abe764 (patch) | |
tree | 8a06a4354e00c09ee8b87e69f8aa6f2825cc7eab /llvm | |
parent | 44a14d95c2472c380cca0b2cb7605a65cb84c18e (diff) | |
download | llvm-d3b76a3b019d4a006350a6cb979b426703abe764.zip llvm-d3b76a3b019d4a006350a6cb979b426703abe764.tar.gz llvm-d3b76a3b019d4a006350a6cb979b426703abe764.tar.bz2 |
TLI: Use lambda. NFC.
llvm-svn: 231011
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Analysis/TargetLibraryInfo.cpp | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp index 91041fc..e1b028e 100644 --- a/llvm/lib/Analysis/TargetLibraryInfo.cpp +++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp @@ -714,25 +714,6 @@ TargetLibraryInfoImpl &TargetLibraryInfoImpl::operator=(TargetLibraryInfoImpl && return *this; } -namespace { -struct StringComparator { - /// Compare two strings and return true if LHS is lexicographically less than - /// RHS. Requires that RHS doesn't contain any zero bytes. - bool operator()(const char *LHS, StringRef RHS) const { - // Compare prefixes with strncmp. If prefixes match we know that LHS is - // greater or equal to RHS as RHS can't contain any '\0'. - return std::strncmp(LHS, RHS.data(), RHS.size()) < 0; - } - - // Provided for compatibility with MSVC's debug mode. - bool operator()(StringRef LHS, const char *RHS) const { return LHS < RHS; } - bool operator()(StringRef LHS, StringRef RHS) const { return LHS < RHS; } - bool operator()(const char *LHS, const char *RHS) const { - return std::strcmp(LHS, RHS) < 0; - } -}; -} - bool TargetLibraryInfoImpl::getLibFunc(StringRef funcName, LibFunc::Func &F) const { const char **Start = &StandardNames[0]; @@ -747,7 +728,10 @@ bool TargetLibraryInfoImpl::getLibFunc(StringRef funcName, // strip it if present. if (funcName.front() == '\01') funcName = funcName.substr(1); - const char **I = std::lower_bound(Start, End, funcName, StringComparator()); + const char **I = std::lower_bound( + Start, End, funcName, [](const char *LHS, StringRef RHS) { + return std::strncmp(LHS, RHS.data(), RHS.size()) < 0; + }); if (I != End && *I == funcName) { F = (LibFunc::Func)(I - Start); return true; |