Bug 641685 - Make sure generated code for IPDL bridged includes all necessary forward decls (r=bsmedberg)

This commit is contained in:
Bill McCloskey 2014-10-29 08:04:51 -07:00
parent 0d32d7e902
commit 43b7a1a0c8

View File

@ -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')