2017-03-04 02:02:02 +08:00
|
|
|
// RUN: %clang_analyze_cc1 -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
|
|
|
|
2013-07-26 01:22:02 +08:00
|
|
|
// Test function pointer casts.
|
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
|
|
|
|
2013-07-26 01:22:02 +08:00
|
|
|
// Test casts from void* to function pointers.
|
2009-03-06 06:47:06 +08:00
|
|
|
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
|
|
|
}
|
2013-07-26 01:22:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
// PR16690
|
|
|
|
_Bool testLocAsIntegerToBool() {
|
|
|
|
return (long long)&testLocAsIntegerToBool;
|
|
|
|
}
|