[cfe-commits] r50795 - /cfe/trunk/lib/Analysis/CFRefCount.cpp
Ted Kremenek
kremenek at apple.com
Tue May 6 20:45:06 PDT 2008
Author: kremenek
Date: Tue May 6 22:45:05 2008
New Revision: 50795
URL: http://llvm.org/viewvc/llvm-project?rev=50795&view=rev
Log:
Added auto-summary generation for createXXX, copyXXX, newXXX methods.
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=50795&r1=50794&r2=50795&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Tue May 6 22:45:05 2008
@@ -593,33 +593,29 @@
}
#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.
-
- assert (ScratchArgs.empty());
-
- if (S.isUnarySelector()) {
- RetainSummary* Summ = getPersistentSummary(RetEffect::MakeNoRet());
- return Summ;
- }
+ // "copyXXX", "createXXX", "newXXX": allocators.
- 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;
}
More information about the cfe-commits
mailing list