Teach the static analyzer to not treat XPC types as CF types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147506 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ted Kremenek 2012-01-04 00:35:48 +00:00
Родитель 0507f7ee76
Коммит 1c87980ef1
2 изменённых файлов: 19 добавлений и 1 удалений

Просмотреть файл

@ -68,7 +68,9 @@ bool cocoa::isRefType(QualType RetTy, StringRef Prefix,
StringRef TDName = TD->getDecl()->getIdentifier()->getName();
if (TDName.startswith(Prefix) && TDName.endswith("Ref"))
return true;
// XPC unfortunately uses CF-style function names, but aren't CF types.
if (TDName.startswith("xpc_"))
return false;
RetTy = TD->getDecl()->getUnderlyingType();
}

Просмотреть файл

@ -42,6 +42,7 @@ typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
typedef unsigned int UInt32;
typedef signed long CFIndex;
typedef CFIndex CFByteOrder;
typedef struct {
CFIndex location;
CFIndex length;
@ -1604,3 +1605,18 @@ void rdar10232019_positive() {
NSLog(@"%@", otherString);
}
// RetainCountChecker support for XPC.
// <rdar://problem/9658496>
typedef void * xpc_object_t;
xpc_object_t _CFXPCCreateXPCObjectFromCFObject(CFTypeRef cf);
void xpc_release(xpc_object_t object);
void rdar9658496() {
CFStringRef cf;
xpc_object_t xpc;
cf = CFStringCreateWithCString( ((CFAllocatorRef)0), "test", kCFStringEncodingUTF8 ); // no-warning
xpc = _CFXPCCreateXPCObjectFromCFObject( cf );
CFRelease(cf);
xpc_release(xpc);
}