diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-05-07 03:45:05 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-05-07 03:45:05 +0000 |
commit | a4b695a935fa81eefd3b4c33d4d5ae33e33bb4d0 (patch) | |
tree | 57288b7734cbf2fc31eeca3d39d324dac0638353 /lib/Analysis/CFRefCount.cpp | |
parent | 1919032c9b6e9969e42093ee2e75a4de6abcb2b0 (diff) |
Added auto-summary generation for createXXX, copyXXX, newXXX methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50795 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r-- | lib/Analysis/CFRefCount.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index b0eddf505d..8e26b679e8 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -593,33 +593,29 @@ RetainSummaryManager::getMethodSummary(ObjCMessageExpr* ME) { } #endif + if (!ME->getType()->isPointerType()) + return 0; + // "initXXX": pass-through for receiver. const char* s = S.getIdentifierInfoForSlot(0)->getName(); + assert (ScratchArgs.empty()); if (strncmp(s, "init", 4) == 0) return getInitMethodSummary(S); -#if 0 - // Generate a summary. For all "setYYY:" and "addXXX:" slots => StopTracking. + // "copyXXX", "createXXX", "newXXX": allocators. - assert (ScratchArgs.empty()); - - if (S.isUnarySelector()) { - RetainSummary* Summ = getPersistentSummary(RetEffect::MakeNoRet()); - return Summ; - } - - for (unsigned i = 0, e = ME->getNumArgs(); i!=e; ++i) { - IdentifierInfo *II = S.getIdentifierInfoForSlot(i); - const char* s = II->getName(); - - if (strncmp(s, "set", 3) == 0 || strncmp(s, "add", 3) == 0) - ScratchArgs.push_back(std::make_pair(i, StopTracking)); + if (strcasestr(s, "create") == 0 || strcasestr(s, "copy") == 0 || + strcasestr(s, "new") == 0) { + RetEffect E = isGCEnabled() ? RetEffect::MakeNoRet() + : RetEffect::MakeOwned(); + RetainSummary* Summ = getPersistentSummary(E); + ObjCMethSummaries[S] = Summ; + return Summ; } -#endif return 0; } |