Bug 641685 - Make sure generated code for IPDL bridged includes all necessary forward decls (r=bsmedberg)
authorBill McCloskey <wmccloskey@mozilla.com>
Wed, 29 Oct 2014 08:04:51 -0700
changeset 212941 a469d36c6b825de2b5f93490a7f4eeec57ac8f0f
parent 212940 ee7994387e65177c8bac2c4541f4dd75d81bdcb7
child 212942 0f7fd7a22708cddd947c73b1de162eb1206fea7b
push id27736
push userryanvm@gmail.com
push dateWed, 29 Oct 2014 20:49:13 +0000
treeherdermozilla-central@80e18ff7c7b2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs641685
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 641685 - Make sure generated code for IPDL bridged includes all necessary forward decls (r=bsmedberg)
ipc/ipdl/ipdl/lower.py
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -2642,17 +2642,19 @@ class _GenerateProtocolActorCode(ipdl.as
                 CppDirective('endif')
             ])
 
         cppheaders = [CppDirective('include', '"%s"' % filename)
                       for filename in ipdl.builtin.CppIncludes]
 
         cf.addthings((
             [ Whitespace.NL ]
-            + self.protocolCxxIncludes
+            + [ CppDirective(
+                'include',
+                '"%s.h"' % (inc)) for inc in self.protocolCxxIncludes ]
             + [ Whitespace.NL ]
             + cppheaders
             + [ Whitespace.NL ]))
 
         cppns = makeNamespace(self.protocol, cf)
         cppns.addstmts([
             Whitespace.NL,
             Whitespace.NL,
@@ -2683,27 +2685,29 @@ class _GenerateProtocolActorCode(ipdl.as
 
     def visitInclude(self, inc):
         ip = inc.tu.protocol
         if not ip:
             return
 
         self.actorForwardDecls.extend([
             _makeForwardDeclForActor(ip.decl.type, self.side),
+            _makeForwardDeclForActor(ip.decl.type, _otherSide(self.side)),
             Whitespace.NL
         ])
-        self.protocolCxxIncludes.append(
-            CppDirective(
-                'include',
-                '"%s.h"'% (_protocolHeaderName(ip, self.side))))
+        self.protocolCxxIncludes.append(_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)))
+                Type(_actorName(ip.decl.fullname, self.side.title())),
+                _actorName(ip.decl.shortname, self.side.title())))
+
+            self.includedActorTypedefs.append(Typedef(
+                Type(_actorName(ip.decl.fullname, _otherSide(self.side).title())),
+                _actorName(ip.decl.shortname, _otherSide(self.side).title())))
 
 
     def visitProtocol(self, p):
         self.hdrfile.addthings([
             CppDirective('ifdef', 'DEBUG'),
             CppDirective('include', '"prenv.h"'),
             CppDirective('endif', '// DEBUG')
         ])
@@ -4220,16 +4224,19 @@ class _GenerateProtocolActorCode(ipdl.as
             StmtDecl(Decl(Type('TransportDescriptor'), tdvar.name)),
             StmtDecl(Decl(Type('ProcessId'), pidvar.name)),
             StmtDecl(Decl(Type('ProtocolId'), pvar.name)),
             iffail,
             Whitespace.NL
         ])
 
         def makeHandlerCase(actor):
+            self.protocolCxxIncludes.append(_protocolHeaderName(actor.ptype._ast,
+                                                                actor.side))
+
             case = StmtBlock()
             modevar = _sideToTransportMode(actor.side)
             tvar = ExprVar('t')
             iffailopen = StmtIf(ExprNot(ExprAssn(
                 tvar,
                 ExprCall(ExprVar('mozilla::ipc::OpenDescriptor'),
                          args=[ tdvar, modevar ]))))
             iffailopen.addifstmt(StmtReturn(_Result.ValuError))