qapi: Make code-generating visitors use QAPIGen more

The use of QAPIGen is rather shallow so far: most of the output
accumulation is not converted. Take the next step: convert output
accumulation in the code-generating visitor classes. Helper functions
outside these classes are not converted.

Backports commit 71b3f0459c460c9e16a47372ccddbfa6e2c7aadf from qemu
This commit is contained in:
Markus Armbruster 2018-03-09 09:10:38 -05:00 committed by Lioncash
parent 58246ea9d9
commit b882e705dc
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
4 changed files with 102 additions and 122 deletions

View file

@ -2054,3 +2054,14 @@ class QAPIGenDoc(QAPIGen):
return (QAPIGen._top(self, fname)
+ '@c AUTOMATICALLY GENERATED, DO NOT MODIFY\n\n')
class QAPISchemaMonolithicCVisitor(QAPISchemaVisitor):
def __init__(self, prefix, what, blurb, pydoc):
self._prefix = prefix
self._what = what
self._genc = QAPIGenC(blurb, pydoc)
self._genh = QAPIGenH(blurb, pydoc)
def write(self, output_dir):
self._genc.write(output_dir, self._prefix + self._what + '.c')
self._genh.write(output_dir, self._prefix + self._what + '.h')