|
34 | 34 | #include <stdarg.h>
|
35 | 35 |
|
36 | 36 | using namespace clang;
|
| 37 | + |
| 38 | +//===----------------------------------------------------------------------===// |
| 39 | +// Utility functions. |
| 40 | +//===----------------------------------------------------------------------===// |
| 41 | + |
37 | 42 | using llvm::CStrInCStrNoCase;
|
38 | 43 |
|
| 44 | +// The "fundamental rule" for naming conventions of methods: |
| 45 | +// (url broken into two lines) |
| 46 | +// http://developer.apple.com/documentation/Cocoa/Conceptual/ |
| 47 | +// MemoryMgmt/Tasks/MemoryManagementRules.html |
| 48 | +// |
| 49 | +// "You take ownership of an object if you create it using a method whose name |
| 50 | +// begins with “alloc” or “new” or contains “copy” (for example, alloc, |
| 51 | +// newObject, or mutableCopy), or if you send it a retain message. You are |
| 52 | +// responsible for relinquishing ownership of objects you own using release |
| 53 | +// or autorelease. Any other time you receive an object, you must |
| 54 | +// not release it." |
| 55 | +// |
| 56 | +static bool followsFundamentalRule(const char* s) { |
| 57 | + return CStrInCStrNoCase(s, "create") || CStrInCStrNoCase(s, "copy") || |
| 58 | + CStrInCStrNoCase(s, "new") == s || CStrInCStrNoCase(s, "alloc") == s; |
| 59 | +} |
| 60 | + |
39 | 61 | //===----------------------------------------------------------------------===//
|
40 | 62 | // Selector creation functions.
|
41 | 63 | //===----------------------------------------------------------------------===//
|
@@ -1834,22 +1856,6 @@ void CFRefCount::EvalStore(ExplodedNodeSet<GRState>& Dst,
|
1834 | 1856 |
|
1835 | 1857 | // End-of-path.
|
1836 | 1858 |
|
1837 |
| -// The "fundamental rule" for naming conventions of methods: |
1838 |
| -// (url broken into two lines) |
1839 |
| -// http://developer.apple.com/documentation/Cocoa/Conceptual/ |
1840 |
| -// MemoryMgmt/Tasks/MemoryManagementRules.html |
1841 |
| -// |
1842 |
| -// "You take ownership of an object if you create it using a method whose name |
1843 |
| -// begins with “alloc” or “new” or contains “copy” (for example, alloc, |
1844 |
| -// newObject, or mutableCopy), or if you send it a retain message. You are |
1845 |
| -// responsible for relinquishing ownership of objects you own using release |
1846 |
| -// or autorelease. Any other time you receive an object, you must |
1847 |
| -// not release it." |
1848 |
| -// |
1849 |
| -static bool followsFundamentalRule(const char* s) { |
1850 |
| - return CStrInCStrNoCase(s, "create") || CStrInCStrNoCase(s, "copy") || |
1851 |
| - CStrInCStrNoCase(s, "new"); |
1852 |
| -} |
1853 | 1859 |
|
1854 | 1860 | std::pair<GRStateRef,bool>
|
1855 | 1861 | CFRefCount::HandleSymbolDeath(GRStateManager& VMgr,
|
|
0 commit comments