2012-08-25 04:39:55 +08:00
|
|
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core -analyzer-store=region -verify %s
|
2012-10-19 20:44:48 +08:00
|
|
|
// expected-no-diagnostics
|
2009-03-06 04:22:13 +08:00
|
|
|
|
|
|
|
// Test function pointer casts. Currently we track function addresses using
|
|
|
|
// loc::FunctionVal. Because casts can be arbitrary, do we need to model
|
|
|
|
// functions with regions?
|
2009-03-06 06:47:06 +08:00
|
|
|
typedef void* (*MyFuncTest1)(void);
|
2009-03-06 04:22:13 +08:00
|
|
|
|
|
|
|
MyFuncTest1 test1_aux(void);
|
|
|
|
void test1(void) {
|
|
|
|
void *x;
|
|
|
|
void* (*p)(void);
|
|
|
|
p = ((void*) test1_aux());
|
|
|
|
if (p != ((void*) 0)) x = (*p)();
|
|
|
|
}
|
2009-03-06 06:47:06 +08:00
|
|
|
|
|
|
|
// Test casts from void* to function pointers. Same issue as above:
|
|
|
|
// should we eventually model function pointers using regions?
|
|
|
|
void* test2(void *p) {
|
|
|
|
MyFuncTest1 fp = (MyFuncTest1) p;
|
|
|
|
return (*fp)();
|
|
|
|
}
|
2011-09-13 01:56:08 +08:00
|
|
|
|
|
|
|
// <radar://10087620>
|
|
|
|
// A cast from int onjective C property reference to int.
|
|
|
|
typedef signed char BOOL;
|
|
|
|
@protocol NSObject - (BOOL)isEqual:(id)object; @end
|
|
|
|
@interface NSObject <NSObject> {} - (id)init; @end
|
|
|
|
typedef enum {
|
2011-09-13 02:28:35 +08:00
|
|
|
EEOne,
|
|
|
|
EETwo
|
|
|
|
} RDR10087620Enum;
|
|
|
|
@interface RDR10087620 : NSObject {
|
|
|
|
RDR10087620Enum elem;
|
2011-09-13 01:56:08 +08:00
|
|
|
}
|
2011-09-13 02:28:35 +08:00
|
|
|
@property (readwrite, nonatomic) RDR10087620Enum elem;
|
2011-11-06 17:01:30 +08:00
|
|
|
@end
|
|
|
|
|
2011-09-13 01:56:08 +08:00
|
|
|
static void
|
2011-09-13 02:28:35 +08:00
|
|
|
adium_media_ready_cb(RDR10087620 *InObj)
|
2011-09-13 01:56:08 +08:00
|
|
|
{
|
2011-09-13 02:28:35 +08:00
|
|
|
InObj.elem |= EEOne;
|
2011-09-13 01:56:08 +08:00
|
|
|
}
|