Eli Friedman | 4219c66 | 2011-11-08 19:55:32 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm %s -o - -triple i386-apple-macosx10.7.2 |
Eric Christopher | 335552e | 2011-08-19 23:08:33 +0000 | [diff] [blame] | 2 | // PR1084 |
| 3 | |
| 4 | extern "C" |
| 5 | { |
| 6 | typedef unsigned char PRUint8; |
| 7 | typedef unsigned int PRUint32; |
| 8 | } |
| 9 | typedef PRUint32 nsresult; |
| 10 | struct nsID |
| 11 | { |
| 12 | }; |
| 13 | typedef nsID nsIID; |
| 14 | class nsISupports |
| 15 | { |
| 16 | }; |
| 17 | extern "C++" |
| 18 | { |
| 19 | template < class T > struct nsCOMTypeInfo |
| 20 | { |
| 21 | static const nsIID & GetIID () |
| 22 | { |
| 23 | } |
| 24 | }; |
| 25 | } |
| 26 | |
| 27 | class nsIDOMEvent:public nsISupports |
| 28 | { |
| 29 | }; |
| 30 | class nsIDOMEventListener:public nsISupports |
| 31 | { |
| 32 | public:static const nsIID & GetIID () |
| 33 | { |
| 34 | } |
| 35 | virtual nsresult |
| 36 | __attribute__ ((regparm (0), cdecl)) HandleEvent (nsIDOMEvent * event) = |
| 37 | 0; |
| 38 | }; |
| 39 | class nsIDOMMouseListener:public nsIDOMEventListener |
| 40 | { |
| 41 | public:static const nsIID & GetIID () |
| 42 | { |
| 43 | static const nsIID iid = { |
| 44 | }; |
| 45 | } |
| 46 | virtual nsresult |
| 47 | __attribute__ ((regparm (0), |
| 48 | cdecl)) MouseDown (nsIDOMEvent * aMouseEvent) = 0; |
| 49 | }; |
| 50 | typedef |
| 51 | typeof (&nsIDOMEventListener::HandleEvent) |
| 52 | GenericHandler; |
| 53 | struct EventDispatchData |
| 54 | { |
| 55 | PRUint32 message; |
| 56 | GenericHandler method; |
| 57 | PRUint8 bits; |
| 58 | }; |
| 59 | struct EventTypeData |
| 60 | { |
| 61 | const EventDispatchData *events; |
| 62 | int numEvents; |
| 63 | const nsIID *iid; |
| 64 | }; |
| 65 | static const EventDispatchData sMouseEvents[] = { |
| 66 | { |
| 67 | (300 + 2), |
| 68 | reinterpret_cast < GenericHandler > (&nsIDOMMouseListener::MouseDown), |
| 69 | 0x01} |
| 70 | }; |
| 71 | static const EventTypeData sEventTypes[] = { |
| 72 | { |
| 73 | sMouseEvents, (sizeof (sMouseEvents) / sizeof (sMouseEvents[0])), |
| 74 | &nsCOMTypeInfo < nsIDOMMouseListener >::GetIID ()} |
| 75 | }; |