2012-08-25 00:39:55 +04:00
|
|
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core -analyzer-store=region -verify %s
|
2012-10-19 16:44:48 +04:00
|
|
|
// expected-no-diagnostics
|
2009-03-05 23:22:13 +03: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 01:47:06 +03:00
|
|
|
typedef void* (*MyFuncTest1)(void);
|
2009-03-05 23:22:13 +03: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 01:47:06 +03: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-12 21:56:08 +04: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-12 22:28:35 +04:00
|
|
|
EEOne,
|
|
|
|
EETwo
|
|
|
|
} RDR10087620Enum;
|
|
|
|
@interface RDR10087620 : NSObject {
|
|
|
|
RDR10087620Enum elem;
|
2011-09-12 21:56:08 +04:00
|
|
|
}
|
2011-09-12 22:28:35 +04:00
|
|
|
@property (readwrite, nonatomic) RDR10087620Enum elem;
|
2011-11-06 13:01:30 +04:00
|
|
|
@end
|
|
|
|
|
2011-09-12 21:56:08 +04:00
|
|
|
static void
|
2011-09-12 22:28:35 +04:00
|
|
|
adium_media_ready_cb(RDR10087620 *InObj)
|
2011-09-12 21:56:08 +04:00
|
|
|
{
|
2011-09-12 22:28:35 +04:00
|
|
|
InObj.elem |= EEOne;
|
2011-09-12 21:56:08 +04:00
|
|
|
}
|