qapi: Clean up modular built-in code generation a bit
commitdcac64711ea906e844ae60a5927e5580f7252c1e
authorMarkus Armbruster <armbru@redhat.com>
Thu, 14 Feb 2019 15:22:36 +0000 (14 16:22 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 18 Feb 2019 13:44:04 +0000 (18 14:44 +0100)
treec301702ab4cff7e031d6c8638a7fd9d1a031a57d
parent83a22d89b0d96cba0b2b6d843a443e3400322e0b
qapi: Clean up modular built-in code generation a bit

We neglect to call .visit_module() for the special module we use for
built-ins.  Harmless, but clean it up anyway.  The
tests/qapi-schema/*.out now show the built-in module as 'module None'.

Subclasses of QAPISchemaModularCVisitor need to ._add_module() this
special module to enable code generation for built-ins.  When this
hasn't been done, QAPISchemaModularCVisitor.visit_module() does
nothing for the special module.  That looks like built-ins could
accidentally be generated into the wrong module when a subclass
neglects to call ._add_module().  Can't happen, because built-ins are
all visited before any other module.  But that's non-obvious.  Switch
off code generation explicitly.

Rename QAPISchemaModularCVisitor._begin_module() to
._begin_user_module().

New QAPISchemaModularCVisitor._is_builtin_module(), for clarity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190214152251.2073-4-armbru@redhat.com>
16 files changed:
scripts/qapi/commands.py
scripts/qapi/common.py
scripts/qapi/events.py
scripts/qapi/types.py
scripts/qapi/visit.py
tests/qapi-schema/comments.out
tests/qapi-schema/doc-bad-section.out
tests/qapi-schema/doc-good.out
tests/qapi-schema/empty.out
tests/qapi-schema/event-case.out
tests/qapi-schema/ident-with-escape.out
tests/qapi-schema/include-relpath.out
tests/qapi-schema/include-repetition.out
tests/qapi-schema/include-simple.out
tests/qapi-schema/indented-expr.out
tests/qapi-schema/qapi-schema-test.out