diff options
author | John McCall <rjmccall@apple.com> | 2011-04-06 09:02:12 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-04-06 09:02:12 +0000 |
commit | 98b8f16a0b056919f24206a8a3ca86f9ea75fa34 (patch) | |
tree | eb5afad73d2e8e0bb10408a04f7bdcc70d9bc4b5 | |
parent | 018e02cc19d2635416a8b2b76f3c8faf6c361afb (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128998 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/StaticAnalyzer/Core/CFRefCount.cpp | 2 | ||||
-rw-r--r-- | test/Analysis/retain-release.m | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Core/CFRefCount.cpp b/lib/StaticAnalyzer/Core/CFRefCount.cpp index 416e1209ae..5131c73925 100644 --- a/lib/StaticAnalyzer/Core/CFRefCount.cpp +++ b/lib/StaticAnalyzer/Core/CFRefCount.cpp @@ -1201,7 +1201,7 @@ RetainSummaryManager::updateSummaryFromAnnotations(RetainSummary &Summ, // 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) diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m index 2a1d187d56..8306896b0c 100644 --- a/test/Analysis/retain-release.m +++ b/test/Analysis/retain-release.m @@ -1453,3 +1453,10 @@ static void rdar_8724287(CFErrorRef error) } } +// <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()); +} |