Use StringRef::substr() and unbounded StringRef::compare() instead of bounded version of StringRef::compare() because bounded version of StringRef::compare() is going to be removed.

llvm-svn: 130425
diff --git a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
index 534b887..a6a256a 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
@@ -1190,7 +1190,14 @@
       // For now, give up.
       return;
     } else {
-      result = s1StrRef.compare(s2StrRef, (size_t)lenInt.getLimitedValue());
+      // Create substrings of each to compare the prefix.
+      llvm::StringRef s1SubStr = 
+        s1StrRef.substr(0, (size_t)lenInt.getLimitedValue());
+      llvm::StringRef s2SubStr = 
+        s2StrRef.substr(0, (size_t)lenInt.getLimitedValue());
+
+      // Compare the substrings.
+      result = s1SubStr.compare(s2SubStr);
     }
   } else {
     // Compare string 1 to string 2 the same way strcmp() does.