Use llvm::CStrInCStrNoCase instead of strcasestr, since the latter is not portable.

Correctly check if the result of CStrInCStrNoCase is NULL to generate summaries; before we were inverting the condition.

llvm-svn: 50822
This commit is contained in:
Ted Kremenek 2008-05-07 18:36:45 +00:00
parent 3a9fa4e360
commit b6cbf28d82
1 changed files with 4 additions and 2 deletions

View File

@ -23,11 +23,13 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/ImmutableMap.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Compiler.h"
#include <ostream>
#include <sstream>
using namespace clang;
using llvm::CStrInCStrNoCase;
//===----------------------------------------------------------------------===//
// Utility functions.
@ -604,8 +606,8 @@ RetainSummaryManager::getMethodSummary(ObjCMessageExpr* ME) {
if (!isNSType(ME->getReceiver()->getType()))
return 0;
if (strcasestr(s, "create") == 0 || strcasestr(s, "copy") == 0 ||
strcasestr(s, "new") == 0) {
if (CStrInCStrNoCase(s, "create") || CStrInCStrNoCase(s, "copy") ||
CStrInCStrNoCase(s, "new")) {
RetEffect E = isGCEnabled() ? RetEffect::MakeNoRet()
: RetEffect::MakeOwned();