[PATCH] Add {start,end}with_lower methods to StringRef.
Rui Ueyama
ruiu at google.com
Tue Oct 29 14:04:37 PDT 2013
================
Comment at: lib/Support/StringRef.cpp:53-55
@@ -49,1 +52,5 @@
+/// compare_lower - Compare strings, ignoring case.
+int StringRef::compare_lower(StringRef RHS) const {
+ if (int Res = ascii_strncasecmp(Data, RHS.Data, min(Length, RHS.Length)))
+ return Res;
if (Length == RHS.Length)
----------------
Shankar Kalpathi Easwaran wrote:
> return early if Length < RHS.Length.
We cannot return early. We need to compare string contents first. Only if their prefixes are the same, the shorter string wins. Consider compare_lower("a", "bb") and compare_lower("c", "bb") for examples. -1 and 1 should be returned, respectively.
http://llvm-reviews.chandlerc.com/D2041
More information about the llvm-commits
mailing list