summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CFRefCount.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-05-07 03:45:05 +0000
committerTed Kremenek <kremenek@apple.com>2008-05-07 03:45:05 +0000
commit08eb30f193c9097538eae9ad91b13fd70e5aa1e0 (patch)
tree7afdd70955bb61161fa9a4cecfc7a27b16c37100 /clang/lib/Analysis/CFRefCount.cpp
parent7ca4a67ca189dfadaab2fd86eebb9bdf02d2dc1c (diff)
downloadbcm5719-llvm-08eb30f193c9097538eae9ad91b13fd70e5aa1e0.tar.gz
bcm5719-llvm-08eb30f193c9097538eae9ad91b13fd70e5aa1e0.zip
Added auto-summary generation for createXXX, copyXXX, newXXX methods.
llvm-svn: 50795
Diffstat (limited to 'clang/lib/Analysis/CFRefCount.cpp')
-rw-r--r--clang/lib/Analysis/CFRefCount.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp
index b0eddf505d2..8e26b679e84 100644
--- a/clang/lib/Analysis/CFRefCount.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud