[cfe-commits] r93175 - in /cfe/trunk: include/clang/Analysis/PathSensitive/BugReporter.h lib/Analysis/CFRefCount.cpp
Benjamin Kramer
benny.kra at googlemail.com
Mon Jan 11 11:46:28 PST 2010
Author: d0k
Date: Mon Jan 11 13:46:28 2010
New Revision: 93175
URL: http://llvm.org/viewvc/llvm-project?rev=93175&view=rev
Log:
Avoid use of deprecated functions (CStrInCStrNoCase and StringsEqualNoCase).
Modified:
cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h
cfe/trunk/lib/Analysis/CFRefCount.cpp
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h?rev=93175&r1=93174&r2=93175&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h Mon Jan 11 13:46:28 2010
@@ -23,7 +23,6 @@
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallString.h"
-#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/ImmutableSet.h"
#include <list>
Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=93175&r1=93174&r2=93175&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Mon Jan 11 13:46:28 2010
@@ -52,8 +52,8 @@
// not release it."
//
-using llvm::CStrInCStrNoCase;
-using llvm::StringsEqualNoCase;
+using llvm::StrInStrNoCase;
+using llvm::StringRef;
enum NamingConvention { NoConvention, CreateRule, InitRule };
@@ -122,20 +122,20 @@
break;
case 3:
// Methods starting with 'new' follow the create rule.
- if (AtBeginning && StringsEqualNoCase("new", s, len))
+ if (AtBeginning && StringRef(s, len).equals_lower("new"))
C = CreateRule;
break;
case 4:
// Methods starting with 'alloc' or contain 'copy' follow the
// create rule
- if (C == NoConvention && StringsEqualNoCase("copy", s, len))
+ if (C == NoConvention && StringRef(s, len).equals_lower("copy"))
C = CreateRule;
else // Methods starting with 'init' follow the init rule.
- if (AtBeginning && StringsEqualNoCase("init", s, len))
+ if (AtBeginning && StringRef(s, len).equals_lower("init"))
C = InitRule;
break;
case 5:
- if (AtBeginning && StringsEqualNoCase("alloc", s, len))
+ if (AtBeginning && StringRef(s, len).equals_lower("alloc"))
C = CreateRule;
break;
}
@@ -1372,11 +1372,11 @@
// "AppendValue", or "SetAttribute", then we assume that arguments may
// "escape." This means that something else holds on to the object,
// allowing it be used even after its local retain count drops to 0.
- ArgEffect E = (CStrInCStrNoCase(FName, "InsertValue") ||
- CStrInCStrNoCase(FName, "AddValue") ||
- CStrInCStrNoCase(FName, "SetValue") ||
- CStrInCStrNoCase(FName, "AppendValue") ||
- CStrInCStrNoCase(FName, "SetAttribute"))
+ ArgEffect E = (StrInStrNoCase(FName, "InsertValue") != StringRef::npos||
+ StrInStrNoCase(FName, "AddValue") != StringRef::npos ||
+ StrInStrNoCase(FName, "SetValue") != StringRef::npos ||
+ StrInStrNoCase(FName, "AppendValue") != StringRef::npos||
+ StrInStrNoCase(FName, "SetAttribute")) != StringRef::npos
? MayEscape : DoNothing;
S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, E);
@@ -1555,7 +1555,8 @@
if (S.isKeywordSelector()) {
const std::string &str = S.getAsString();
assert(!str.empty());
- if (CStrInCStrNoCase(&str[0], "delegate:")) ReceiverEff = StopTracking;
+ if (StrInStrNoCase(str, "delegate:") != StringRef::npos)
+ ReceiverEff = StopTracking;
}
// Look for methods that return an owned object.
More information about the cfe-commits
mailing list