qapi: Generate in source order

The generators' conversion to visitors (merge commit 9e72681d16)
changed the processing order of entities from source order to
alphabetical order. The next commit needs source order, so change it
back.

Backports commit 8a84767cc4f7e00e5dd62435c32be9e7d2cbe4d3 from qemu
This commit is contained in:
Markus Armbruster 2018-03-09 09:00:10 -05:00 committed by Lioncash
parent cad1593b7d
commit 6fe71ebc68
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -1483,6 +1483,7 @@ class QAPISchema(object):
parser = QAPISchemaParser(open(fname, 'r'))
exprs = check_exprs(parser.exprs)
self.docs = parser.docs
self._entity_list = []
self._entity_dict = {}
self._predefining = True
self._def_predefineds()
@ -1494,6 +1495,7 @@ class QAPISchema(object):
# Only the predefined types are allowed to not have info
assert ent.info or self._predefining
assert ent.name not in self._entity_dict
self._entity_list.append(ent)
self._entity_dict[ent.name] = ent
def lookup_entity(self, name, typ=None):
@ -1692,12 +1694,12 @@ class QAPISchema(object):
assert False
def check(self):
for (name, ent) in sorted(self._entity_dict.items()):
for ent in self._entity_list:
ent.check(self)
def visit(self, visitor):
visitor.visit_begin(self)
for (name, entity) in sorted(self._entity_dict.items()):
for entity in self._entity_list:
if visitor.visit_needed(entity):
entity.visit(visitor)
visitor.visit_end()