Bug 1346345 - Implement != operator for IPDL structs. r=kanru
authorAndrew McCreight <continuation@gmail.com>
Fri, 10 Mar 2017 11:42:07 -0800
changeset 347352 4cbac77c2f8765836722072608db575c0806b17d
parent 347351 b43d8eb6e6c9f3e0a512fbde2c0a992009689f34
child 347353 c93713825d2e8cdcad349ccdfa128965899f9a36
push id31496
push usercbook@mozilla.com
push dateTue, 14 Mar 2017 13:21:57 +0000
treeherdermozilla-central@9a26ed658fdc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskanru
bugs1346345
milestone55.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 1346345 - Implement != operator for IPDL structs. r=kanru MozReview-Commit-ID: H1CDbuXZ5U0
ipc/ipdl/ipdl/lower.py
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -1828,16 +1828,26 @@ def _generateCxxStruct(sd):
         ifneq = StmtIf(ExprNot(
             ExprBinary(ExprCall(f.getMethod()), '==',
                        ExprCall(f.getMethod(ovar)))))
         ifneq.addifstmt(StmtReturn.FALSE)
         opeqeq.addstmt(ifneq)
     opeqeq.addstmt(StmtReturn.TRUE)
     struct.addstmts([ opeqeq, Whitespace.NL ])
 
+    # bool operator!=(const Struct& _o)
+    opneq = MethodDefn(MethodDecl(
+        'operator!=',
+        params=[ Decl(constreftype, ovar.name) ],
+        ret=Type.BOOL,
+        const=1))
+    opneq.addstmt(StmtReturn(ExprNot(ExprCall(ExprVar('operator=='),
+                                              args=[ ovar ]))))
+    struct.addstmts([ opneq, Whitespace.NL ])
+
     # field1& f1()
     # const field1& f1() const
     for f in sd.fields:
         get = MethodDefn(MethodDecl(f.getMethod().name,
                                     params=[ ],
                                     ret=f.refType(),
                                     force_inline=1))
         get.addstmt(StmtReturn(f.refExpr()))