diff options
author | Markus Armbruster | 2021-02-01 20:37:44 +0100 |
---|---|---|
committer | Markus Armbruster | 2021-02-08 14:15:58 +0100 |
commit | c6cd7e4151794194f804ac3b8d2bc9347142c024 (patch) | |
tree | 226e35d1249140b8131b2f4c350b4f3d4ccf93f3 /scripts/qapi/gen.py | |
parent | qapi/gen: Support switching to another module temporarily (diff) | |
download | qemu-c6cd7e4151794194f804ac3b8d2bc9347142c024.tar.gz qemu-c6cd7e4151794194f804ac3b8d2bc9347142c024.tar.xz qemu-c6cd7e4151794194f804ac3b8d2bc9347142c024.zip |
qapi/commands: Simplify command registry generation
QAPISchemaGenCommandVisitor.visit_command() needs to generate the
marshalling function into the current module, and also generate its
registration into the ./init system module. The latter is done
somewhat awkwardly: .__init__() creates a QAPIGenCCode that will not
be written out, each .visit_command() adds its registration to it, and
.visit_end() copies its contents into the ./init module it creates.
Instead provide the means to temporarily switch to another module.
Create the ./init module in .visit_begin(), and generate its initial
part. Add registrations to it in .visit_command(). Finish it in
.visit_end().
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210201193747.2169670-14-jsnow@redhat.com>
Diffstat (limited to 'scripts/qapi/gen.py')
0 files changed, 0 insertions, 0 deletions