• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core -analyzer-store=region -verify %s
2// expected-no-diagnostics
3
4// Test function pointer casts.
5typedef void* (*MyFuncTest1)(void);
6
7MyFuncTest1 test1_aux(void);
8void test1(void) {
9  void *x;
10  void* (*p)(void);
11  p = ((void*) test1_aux());
12  if (p != ((void*) 0)) x = (*p)();
13}
14
15// Test casts from void* to function pointers.
16void* test2(void *p) {
17  MyFuncTest1 fp = (MyFuncTest1) p;
18  return (*fp)();
19}
20
21// <radar://10087620>
22// A cast from int onjective C property reference to int.
23typedef signed char BOOL;
24@protocol NSObject  - (BOOL)isEqual:(id)object; @end
25@interface NSObject <NSObject> {} - (id)init; @end
26typedef enum {
27  EEOne,
28  EETwo
29} RDR10087620Enum;
30@interface RDR10087620 : NSObject {
31  RDR10087620Enum   elem;
32}
33@property (readwrite, nonatomic) RDR10087620Enum elem;
34@end
35
36static void
37adium_media_ready_cb(RDR10087620 *InObj)
38{
39  InObj.elem |= EEOne;
40}
41
42
43// PR16690
44_Bool testLocAsIntegerToBool() {
45  return (long long)&testLocAsIntegerToBool;
46}
47