forked from OSchip/llvm-project
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:
parent
414a2c0951
commit
18470e3287
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue