From 43b7a1a0c84632ef103fb846ff773d676b1117e7 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Wed, 29 Oct 2014 08:04:51 -0700 Subject: [PATCH] Bug 641685 - Make sure generated code for IPDL bridged includes all necessary forward decls (r=bsmedberg) --- ipc/ipdl/ipdl/lower.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/ipc/ipdl/ipdl/lower.py b/ipc/ipdl/ipdl/lower.py index e7817039491d..06f9e44e13c9 100644 --- a/ipc/ipdl/ipdl/lower.py +++ b/ipc/ipdl/ipdl/lower.py @@ -2647,7 +2647,9 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor): cf.addthings(( [ Whitespace.NL ] - + self.protocolCxxIncludes + + [ CppDirective( + 'include', + '"%s.h"' % (inc)) for inc in self.protocolCxxIncludes ] + [ Whitespace.NL ] + cppheaders + [ Whitespace.NL ])) @@ -2688,17 +2690,19 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor): 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): @@ -4225,6 +4229,9 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor): ]) def makeHandlerCase(actor): + self.protocolCxxIncludes.append(_protocolHeaderName(actor.ptype._ast, + actor.side)) + case = StmtBlock() modevar = _sideToTransportMode(actor.side) tvar = ExprVar('t')