[cfe-commits] r58112 - /cfe/trunk/lib/Analysis/CFRefCount.cpp
Ted Kremenek
kremenek at apple.com
Fri Oct 24 14:18:08 PDT 2008
Author: kremenek
Date: Fri Oct 24 16:18:08 2008
New Revision: 58112
URL: http://llvm.org/viewvc/llvm-project?rev=58112&view=rev
Log:
followsFundamentalRule() returns true if "alloc" or "new" appear at the beginning of the string, not anywhere within it.
Modified:
cfe/trunk/lib/Analysis/CFRefCount.cpp
Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=58112&r1=58111&r2=58112&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Fri Oct 24 16:18:08 2008
@@ -34,8 +34,30 @@
#include <stdarg.h>
using namespace clang;
+
+//===----------------------------------------------------------------------===//
+// Utility functions.
+//===----------------------------------------------------------------------===//
+
using llvm::CStrInCStrNoCase;
+// The "fundamental rule" for naming conventions of methods:
+// (url broken into two lines)
+// http://developer.apple.com/documentation/Cocoa/Conceptual/
+// MemoryMgmt/Tasks/MemoryManagementRules.html
+//
+// "You take ownership of an object if you create it using a method whose name
+// begins with âallocâ or ânewâ or contains âcopyâ (for example, alloc,
+// newObject, or mutableCopy), or if you send it a retain message. You are
+// responsible for relinquishing ownership of objects you own using release
+// or autorelease. Any other time you receive an object, you must
+// not release it."
+//
+static bool followsFundamentalRule(const char* s) {
+ return CStrInCStrNoCase(s, "create") || CStrInCStrNoCase(s, "copy") ||
+ CStrInCStrNoCase(s, "new") == s || CStrInCStrNoCase(s, "alloc") == s;
+}
+
//===----------------------------------------------------------------------===//
// Selector creation functions.
//===----------------------------------------------------------------------===//
@@ -1834,22 +1856,6 @@
// End-of-path.
-// The "fundamental rule" for naming conventions of methods:
-// (url broken into two lines)
-// http://developer.apple.com/documentation/Cocoa/Conceptual/
-// MemoryMgmt/Tasks/MemoryManagementRules.html
-//
-// "You take ownership of an object if you create it using a method whose name
-// begins with âallocâ or ânewâ or contains âcopyâ (for example, alloc,
-// newObject, or mutableCopy), or if you send it a retain message. You are
-// responsible for relinquishing ownership of objects you own using release
-// or autorelease. Any other time you receive an object, you must
-// not release it."
-//
-static bool followsFundamentalRule(const char* s) {
- return CStrInCStrNoCase(s, "create") || CStrInCStrNoCase(s, "copy") ||
- CStrInCStrNoCase(s, "new");
-}
std::pair<GRStateRef,bool>
CFRefCount::HandleSymbolDeath(GRStateManager& VMgr,
More information about the cfe-commits
mailing list