Eric Christopher | 7bc54e5 | 2011-08-20 00:37:56 +0000 | [diff] [blame] | 1 | // RUN: %clang -fexceptions -S -emit-llvm %s -o /dev/null |
| 2 | |
| 3 | @interface Object { |
| 4 | @public |
| 5 | Class isa; |
| 6 | } |
| 7 | +initialize; |
| 8 | +alloc; |
| 9 | +new; |
| 10 | +free; |
| 11 | -free; |
| 12 | +(Class)class; |
| 13 | -(Class)class; |
| 14 | -init; |
| 15 | -superclass; |
| 16 | -(const char *)name; |
| 17 | @end |
| 18 | |
| 19 | @interface Frob: Object |
| 20 | @end |
| 21 | |
| 22 | @implementation Frob: Object |
| 23 | @end |
| 24 | |
| 25 | static Frob* _connection = ((void *)0); |
| 26 | |
| 27 | extern void abort(void); |
| 28 | |
| 29 | void test (Object* sendPort) |
| 30 | { |
| 31 | int cleanupPorts = 1; |
| 32 | Frob* receivePort = ((void *)0); |
| 33 | |
| 34 | @try { |
| 35 | receivePort = (Frob *) -1; |
| 36 | _connection = (Frob *) -1; |
| 37 | receivePort = ((void *)0); |
| 38 | sendPort = ((void *)0); |
| 39 | cleanupPorts = 0; |
| 40 | @throw [Object new]; |
| 41 | } |
| 42 | @catch(Frob *obj) { |
| 43 | if(!(0)) abort(); |
| 44 | } |
| 45 | @catch(id exc) { |
| 46 | if(!(!receivePort)) abort(); |
| 47 | if(!(!sendPort)) abort(); |
| 48 | if(!(!cleanupPorts)) abort(); |
| 49 | } |
| 50 | } |