// RUN: %clang_analyze_cc1 -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.RetainCount -verify %s
// RUN: %clang_analyze_cc1 -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.RetainCount -analyzer-inline-max-stack-depth=0 -verify %s
typedef const void * CFTypeRef;
extern CFTypeRef ;
extern void ;
extern CFTypeRef CF_RETURNS_RETAINED;
// A "safe" variant of CFRetain that doesn't crash when a null pointer is
// retained. This is often defined by users in a similar manner. The
// CF_RETURNS_RETAINED annotation is misleading here, because the function
// is not supposed to return an object with a +1 retain count. Instead, it
// is supposed to return an object with +(N+1) retain count, where N is
// the original retain count of 'cf'. However, there is no good annotation
// to use in this case, and it is pointless to provide such annotation
// because the only use cases would be CFRetain and SafeCFRetain.
// So instead we teach the analyzer to be able to accept such code
// and ignore the misplaced annotation.
CFTypeRef CF_RETURNS_RETAINED
// A "safe" variant of CFRelease that doesn't crash when a null pointer is
// released. The CF_CONSUMED annotation seems reasonable here.
void
// The same thing, just with a different naming style.
CFTypeRef CF_RETURNS_RETAINED
void
void ;
void
// Make sure we understand that the second SafeCFRetain doesn't return an
// object with +1 retain count, which we won't be able to release twice.
void
// Regular CFRelease() should behave similarly.
void
// Make sure we understand that the second SafeCFRetain doesn't return an
// object with +1 retain count, which would no longer be owned by us after
// it escapes to escape() and released once.
void
void