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
This commit is contained in:
Lenny Maiorani 2011-04-28 19:31:12 +00:00
parent 414a2c0951
commit 18470e3287
1 changed files with 8 additions and 1 deletions

View File

@ -1190,7 +1190,14 @@ void CStringChecker::evalStrcmpCommon(CheckerContext &C, const CallExpr *CE,
// 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.