brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 7e14fbe Raw
67 lines · c
1//C2void test() {3   void (*foo)(void);4   foo = 0;5   foo(); // warn: function pointer is null6 }7 8 // C++9 class C {10 public:11   void f();12 };13 14 void test() {15   C *pc;16   pc->f(); // warn: object pointer is uninitialized17 }18 19 // C++20 class C {21 public:22   void f();23 };24 25 void test() {26   C *pc = 0;27   pc->f(); // warn: object pointer is null28 }29 30 // Objective-C31 @interface MyClass : NSObject32 @property (readwrite,assign) id x;33 - (long double)longDoubleM;34 @end35 36 void test() {37   MyClass *obj1;38   long double ld1 = [obj1 longDoubleM];39     // warn: receiver is uninitialized40 }41 42 // Objective-C43 @interface MyClass : NSObject44 @property (readwrite,assign) id x;45 - (long double)longDoubleM;46 @end47 48 void test() {49   MyClass *obj1;50   id i = obj1.x; // warn: uninitialized object pointer51 }52 53 // Objective-C54 @interface Subscriptable : NSObject55 - (id)objectAtIndexedSubscript:(unsigned int)index;56 @end57 58 @interface MyClass : Subscriptable59 @property (readwrite,assign) id x;60 - (long double)longDoubleM;61 @end62 63 void test() {64   MyClass *obj1;65   id i = obj1[0]; // warn: uninitialized object pointer66 }67