diff options
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; } |