mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Swift: merge codegen and cppcodegen
Python code was simplified, and now a `--generate` option can be used to drive what can be generated. The extractor pack creation now will use an internally generated dbscheme. This should be the same as the checked in one, but doing so allows `bazel run create-extractor-pack` and `bazel run codegen` to be run independently from one another, while previously the former had to follow the latter in case of a schema change. This is the change that triggered the above simplification, as in order for the two dbscheme files to be identical, the first `// generated` line had to state the same generator script.
This commit is contained in:
@@ -5,7 +5,6 @@ import inflection
|
||||
from toposort import toposort_flatten
|
||||
|
||||
from swift.codegen.lib import cpp, schema
|
||||
from swift.codegen.generators import generator
|
||||
|
||||
|
||||
def _get_type(t: str, trap_affix: str) -> str:
|
||||
@@ -64,13 +63,8 @@ class Processor:
|
||||
|
||||
|
||||
def generate(opts, renderer):
|
||||
assert opts.cpp_output
|
||||
processor = Processor({cls.name: cls for cls in schema.load(opts.schema).classes}, opts.trap_affix)
|
||||
out = opts.cpp_output
|
||||
renderer.render(cpp.ClassList(processor.get_classes(), opts.cpp_namespace, opts.trap_affix,
|
||||
opts.cpp_include_dir, opts.schema), out / f"{opts.trap_affix}Classes.h")
|
||||
|
||||
|
||||
tags = ("cpp", "schema")
|
||||
|
||||
if __name__ == "__main__":
|
||||
generator.run()
|
||||
|
||||
Reference in New Issue
Block a user