Clang analyzer annotations

Hello,

I just wonder why there is an attribute to tell that a functions returns a retained value, but no way to tell that it will release an argument.

It may be useful for example if you want to write a safe CFRelease function:

static __inline__
void SafeCFRelease(CFTypeRef cfobject) {
  if (cfobject) CFRelease(cfobject);
}

I know this attribute was available no so long ago, but I don't see it anymore. What was wrong with it ?

Thanks
Jean-Daniel

Hi Jean-Daniel,

Because these attributes are meant to be supported by Apple, they actually go through an Apple-API review. The ns_returns_retained and cf_returns_retained attributes have been approved for general use. Discussion about supporting other attributes like the ones you mentioned is still ongoing. Rest assured that you aren't the only one who has voiced interest in having additional retain/release attributes.

Ted