1*13076521SEli Friedman // RUN: %clang_cc1 -emit-llvm %s -o - -triple i386-apple-macosx10.7.2
217db0389SEric Christopher // PR1084
317db0389SEric Christopher 
417db0389SEric Christopher extern "C"
517db0389SEric Christopher {
617db0389SEric Christopher   typedef unsigned char PRUint8;
717db0389SEric Christopher   typedef unsigned int PRUint32;
817db0389SEric Christopher }
917db0389SEric Christopher typedef PRUint32 nsresult;
1017db0389SEric Christopher struct nsID
1117db0389SEric Christopher {
1217db0389SEric Christopher };
1317db0389SEric Christopher typedef nsID nsIID;
1417db0389SEric Christopher class nsISupports
1517db0389SEric Christopher {
1617db0389SEric Christopher };
1717db0389SEric Christopher extern "C++"
1817db0389SEric Christopher {
1917db0389SEric Christopher   template < class T > struct nsCOMTypeInfo
2017db0389SEric Christopher   {
GetIIDnsCOMTypeInfo2117db0389SEric Christopher     static const nsIID & GetIID ()
2217db0389SEric Christopher     {
2317db0389SEric Christopher     }
2417db0389SEric Christopher   };
2517db0389SEric Christopher }
2617db0389SEric Christopher 
2717db0389SEric Christopher class nsIDOMEvent:public nsISupports
2817db0389SEric Christopher {
2917db0389SEric Christopher };
3017db0389SEric Christopher class nsIDOMEventListener:public nsISupports
3117db0389SEric Christopher {
GetIID()3217db0389SEric Christopher public:static const nsIID & GetIID ()
3317db0389SEric Christopher   {
3417db0389SEric Christopher   }
3517db0389SEric Christopher   virtual nsresult
3617db0389SEric Christopher     __attribute__ ((regparm (0), cdecl)) HandleEvent (nsIDOMEvent * event) =
3717db0389SEric Christopher     0;
3817db0389SEric Christopher };
3917db0389SEric Christopher class nsIDOMMouseListener:public nsIDOMEventListener
4017db0389SEric Christopher {
GetIID()4117db0389SEric Christopher public:static const nsIID & GetIID ()
4217db0389SEric Christopher   {
4317db0389SEric Christopher     static const nsIID iid = {
4417db0389SEric Christopher     };
4517db0389SEric Christopher   }
4617db0389SEric Christopher   virtual nsresult
4717db0389SEric Christopher     __attribute__ ((regparm (0),
4817db0389SEric Christopher 		    cdecl)) MouseDown (nsIDOMEvent * aMouseEvent) = 0;
4917db0389SEric Christopher };
5017db0389SEric Christopher typedef
5117db0389SEric Christopher typeof (&nsIDOMEventListener::HandleEvent)
5217db0389SEric Christopher   GenericHandler;
5317db0389SEric Christopher      struct EventDispatchData
5417db0389SEric Christopher      {
5517db0389SEric Christopher        PRUint32 message;
5617db0389SEric Christopher        GenericHandler method;
5717db0389SEric Christopher        PRUint8 bits;
5817db0389SEric Christopher      };
5917db0389SEric Christopher      struct EventTypeData
6017db0389SEric Christopher      {
6117db0389SEric Christopher        const EventDispatchData *events;
6217db0389SEric Christopher        int numEvents;
6317db0389SEric Christopher        const nsIID *iid;
6417db0389SEric Christopher      };
6517db0389SEric Christopher      static const EventDispatchData sMouseEvents[] = {
6617db0389SEric Christopher        {
6717db0389SEric Christopher 	(300 + 2),
6817db0389SEric Christopher 	reinterpret_cast < GenericHandler > (&nsIDOMMouseListener::MouseDown),
6917db0389SEric Christopher 	0x01}
7017db0389SEric Christopher      };
7117db0389SEric Christopher static const EventTypeData sEventTypes[] = {
7217db0389SEric Christopher   {
7317db0389SEric Christopher    sMouseEvents, (sizeof (sMouseEvents) / sizeof (sMouseEvents[0])),
7417db0389SEric Christopher    &nsCOMTypeInfo < nsIDOMMouseListener >::GetIID ()}
7517db0389SEric Christopher };
76