Bug 1302442 - Add ignore-initialization-check annotation to class member variables constructed by Codegen. r?peterv draft
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Tue, 20 Sep 2016 15:11:08 +0300
changeset 415520 306466f9c60bce6d5e42f1157e34d922d110fd74
parent 415258 c9971be9e98150ef99d4ef80c6f800ec5915b1ac
child 531628 63f20a56a1c97dada1f147c13df9264646efaad8
push id29891
push userbmo:bpostelnicu@mozilla.com
push dateTue, 20 Sep 2016 13:47:39 +0000
reviewerspeterv
bugs1302442
milestone52.0a1
Bug 1302442 - Add ignore-initialization-check annotation to class member variables constructed by Codegen. r?peterv MozReview-Commit-ID: 2vd6EELGSSj
dom/bindings/Codegen.py
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -10250,25 +10250,28 @@ class ClassDestructor(ClassItem):
             """,
             decorators=self.getDecorators(False),
             className=cgClass.getNameString(),
             body=self.getBody())
 
 
 class ClassMember(ClassItem):
     def __init__(self, name, type, visibility="private", static=False,
-                 body=None):
+                 body=None, hasIgnoreInitCheckFlag=False):
         self.type = type
         self.static = static
         self.body = body
+        self.hasIgnoreInitCheckFlag = hasIgnoreInitCheckFlag;
         ClassItem.__init__(self, name, visibility)
 
     def declare(self, cgClass):
-        return '%s%s %s;\n' % ('static ' if self.static else '', self.type,
-                               self.name)
+        return '%s%s%s %s;\n' % ('static ' if self.static else '',
+                                 'MOZ_INIT_OUTSIDE_CTOR '
+                                 if self.hasIgnoreInitCheckFlag else '',
+                                 self.type, self.name)
 
     def define(self, cgClass):
         if not self.static:
             return ''
         if self.body:
             body = " = " + self.body
         else:
             body = ""
@@ -12495,17 +12498,18 @@ class CGDictionary(CGThing):
             body=body.define())
 
     def getStructs(self):
         d = self.dictionary
         selfName = self.makeClassName(d)
         members = [ClassMember(self.makeMemberName(m[0].identifier.name),
                                self.getMemberType(m),
                                visibility="public",
-                               body=self.getMemberInitializer(m))
+                               body=self.getMemberInitializer(m),
+                               hasIgnoreInitCheckFlag=True)
                    for m in self.memberInfo]
         if d.parent:
             # We always want to init our parent with our non-initializing
             # constructor arg, because either we're about to init ourselves (and
             # hence our parent) or we don't want any init happening.
             baseConstructors = [
                 "%s(%s)" % (self.makeClassName(d.parent),
                             self.getNonInitializingCtorArg())