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

llvm-svn: 128998
This commit is contained in:
John McCall 2011-04-06 09:02:12 +00:00
parent ce5d9aedb9
commit 3337ca5f95
2 changed files with 8 additions and 1 deletions

View File

@ -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)

View File

@ -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());
}