Bug 555573 - [e10s] IPDL generates code which may not compile on Windows, r=cjones
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Mon, 29 Mar 2010 23:29:07 +0300
changeset 41431 f8e5a7f4450a49a245d2b644f7b3475646d65efe
parent 41430 7ad3e029c695fd7198c7aaaa3f26010a9e2e4d8d
child 41432 59779c0f35944f25e821e221eae01a28a34731d3
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs555573
milestone1.9.3a5pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 555573 - [e10s] IPDL generates code which may not compile on Windows, r=cjones
ipc/ipdl/ipdl/cxx/ast.py
ipc/ipdl/ipdl/cxx/cgen.py
ipc/ipdl/ipdl/lower.py
--- a/ipc/ipdl/ipdl/cxx/ast.py
+++ b/ipc/ipdl/ipdl/cxx/ast.py
@@ -66,16 +66,19 @@ class Visitor:
 
     def visitTypeUnion(self, union):
         for t, name in union.components:
             t.accept(self)
 
     def visitTypedef(self, tdef):
         tdef.fromtype.accept(self)
 
+    def visitUsing(self, us):
+        us.type.accept(self)
+
     def visitForwardDecl(self, fd):
         pass
 
     def visitDecl(self, decl):
         decl.type.accept(self)
 
     def visitParam(self, param):
         self.visitDecl(param)
@@ -379,16 +382,21 @@ class TypeUnion(Node):
 class Typedef(Node):
     def __init__(self, fromtype, totypename):
         assert isinstance(totypename, str)
         
         Node.__init__(self)
         self.fromtype = fromtype
         self.totypename = totypename
 
+class Using(Node):
+    def __init__(self, type):
+        Node.__init__(self)
+        self.type = type
+
 class ForwardDecl(Node):
     def __init__(self, pqname, cls=0, struct=0):
         assert (not cls and struct) or (cls and not struct)
 
         self.pqname = pqname
         self.cls = cls
         self.struct = struct
 
--- a/ipc/ipdl/ipdl/cxx/cgen.py
+++ b/ipc/ipdl/ipdl/cxx/cgen.py
@@ -110,16 +110,21 @@ class CxxCodeGen(CodePrinter, Visitor):
         self.printdent('}')
 
 
     def visitTypedef(self, td):
         self.printdent('typedef ')
         td.fromtype.accept(self)
         self.println(' '+ td.totypename +';')
 
+    def visitUsing(self, us):
+        self.printdent('using ')
+        us.type.accept(self)
+        self.println(';')
+
     def visitForwardDecl(self, fd):
         if fd.cls:      self.printdent('class ')
         elif fd.struct: self.printdent('struct ')
         self.write(str(fd.pqname))
         self.println(';')
 
     def visitDecl(self, d):
         # C-syntax arrays make code generation much more annoying
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -2452,16 +2452,17 @@ class _GenerateProtocolActorCode(ipdl.as
         self.prettyside = myside.title()
         self.clsname = None
         self.protocol = None
         self.hdrfile = None
         self.cppfile = None
         self.ns = None
         self.cls = None
         self.includedActorTypedefs = [ ]
+        self.includedActorUsings = [ ]
         self.protocolCxxIncludes = [ ]
 
     def lower(self, tu, clsname, cxxHeaderFile, cxxFile):
         self.clsname = clsname
         self.hdrfile = cxxHeaderFile
         self.cppfile = cxxFile
         tu.accept(self)
 
@@ -2558,18 +2559,18 @@ class _GenerateProtocolActorCode(ipdl.as
                 CppDirective('endif')
             ])
 
         cf.addthings((
             [ Whitespace.NL ]
             + self.protocolCxxIncludes
             + [ Whitespace.NL ]
             + self.standardTypedefs()
-            + self.includedActorTypedefs
             + tu.protocol.decl.cxxtypedefs
+            + self.includedActorUsings
             + [ Whitespace.NL ]))
 
         cppns = makeNamespace(self.protocol, cf)
         cppns.addstmts([
             Whitespace.NL,
             Whitespace.NL,
             clsdefn,
             Whitespace.NL,
@@ -2588,16 +2589,18 @@ class _GenerateProtocolActorCode(ipdl.as
             CppDirective(
                 'include',
                 '"%s.h"'% (_protocolHeaderName(ip, self.side))))
 
         if ip.decl.fullname is not None:
             self.includedActorTypedefs.append(Typedef(
                 Type(_actorName(ip.decl.fullname, self.prettyside)),
                 _actorName(ip.decl.shortname, self.prettyside)))
+            self.includedActorUsings.append(Using(
+                Type(_actorName(ip.decl.fullname, self.prettyside))))
 
 
     def visitProtocol(self, p):
         self.hdrfile.addthings([
             CppDirective('ifdef', 'DEBUG'),
             CppDirective('include', '"prenv.h"'),
             CppDirective('endif', '// DEBUG')
         ])