[cfe-commits] r128998 - in /cfe/trunk: lib/StaticAnalyzer/Core/CFRefCount.cpp test/Analysis/retain-release.m
John McCall
rjmccall at apple.com
Wed Apr 6 02:02:13 PDT 2011
Author: rjmccall
Date: Wed Apr 6 04:02:12 2011
New Revision: 128998
URL: http://llvm.org/viewvc/llvm-project?rev=128998&view=rev
Log:
When updating the retain summary based on {cf,ns}_consumed attributes,
be sure to consume the argument index that actually had the attribute
rather than always the first. rdar://problem/9234108
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/CFRefCount.cpp
cfe/trunk/test/Analysis/retain-release.m
Modified: cfe/trunk/lib/StaticAnalyzer/Core/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CFRefCount.cpp?rev=128998&r1=128997&r2=128998&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/CFRefCount.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CFRefCount.cpp Wed Apr 6 04:02:12 2011
@@ -1201,7 +1201,7 @@
// Effects on the parameters.
unsigned parm_idx = 0;
for (FunctionDecl::param_const_iterator pi = FD->param_begin(),
- pe = FD->param_end(); pi != pe; ++pi) {
+ pe = FD->param_end(); pi != pe; ++pi, ++parm_idx) {
const ParmVarDecl *pd = *pi;
if (pd->getAttr<NSConsumedAttr>()) {
if (!GCEnabled)
Modified: cfe/trunk/test/Analysis/retain-release.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release.m?rev=128998&r1=128997&r2=128998&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/retain-release.m (original)
+++ cfe/trunk/test/Analysis/retain-release.m Wed Apr 6 04:02:12 2011
@@ -1453,3 +1453,10 @@
}
}
+// <rdar://problem/9234108> - Make sure the model applies cf_consumed
+// correctly in argument positions besides the first.
+extern void *CFStringCreate(void);
+extern void rdar_9234108_helper(void *key, void * CF_CONSUMED value);
+void rdar_9234108() {
+ rdar_9234108_helper(0, CFStringCreate());
+}
More information about the cfe-commits
mailing list