Add compare_lower and equals_lower methods to StringRef. Switch all users of
[oota-llvm.git] / include / llvm / ADT / StringRef.h
index 12e2c569def56ec063ecc7a7587df498bfbc1465..269d16af6187add1c9dac9849a5b9f9fbb3dc20b 100644 (file)
@@ -97,6 +97,11 @@ namespace llvm {
               memcmp(Data, RHS.Data, RHS.Length) == 0);
     }
 
+    /// equals_lower - Check for string equality, ignoring case.
+    bool equals_lower(StringRef RHS) const {
+      return Length == RHS.Length && compare_lower(RHS) == 0;
+    }
+
     /// compare - Compare two strings; the result is -1, 0, or 1 if this string
     /// is lexicographically less than, equal to, or greater than the \arg RHS.
     int compare(StringRef RHS) const {
@@ -110,6 +115,9 @@ namespace llvm {
       return Length < RHS.Length ? -1 : 1;
     }
 
+    /// compare_lower - Compare two strings, ignoring case.
+    int compare_lower(StringRef RHS) const;
+
     /// str - Get the contents as an std::string.
     std::string str() const { return std::string(Data, Length); }