From f29a141ab4c4308aed66f930a6f3a42cd20a482d Mon Sep 17 00:00:00 2001 From: rtk0c Date: Sat, 11 Jun 2022 11:37:45 -0700 Subject: Changeset: 70 Fix cmake and codegen infra - Invoke codegen.exe once with a list of changed files, instead of individually for each changed file (this gives the codegen global access to all the code, allowing more things) - Initial support for outputting an archive SQLite database that contains all the code info --- source/20-codegen-compiler/CodegenModel.hpp | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 source/20-codegen-compiler/CodegenModel.hpp (limited to 'source/20-codegen-compiler/CodegenModel.hpp') diff --git a/source/20-codegen-compiler/CodegenModel.hpp b/source/20-codegen-compiler/CodegenModel.hpp new file mode 100644 index 0000000..31ca04f --- /dev/null +++ b/source/20-codegen-compiler/CodegenModel.hpp @@ -0,0 +1,35 @@ +#pragma once + +#include "CodegenConfig.hpp" +#include "CodegenDecl.hpp" +#include "CodegenUtils.hpp" + +#include +#include +#include + +using namespace std::literals; + +class CodegenModel { +private: + class Private; + Private* m; + +public: + CodegenModel(); + ~CodegenModel(); + + // Implementation detail helper, don't use outside + Private& GetPimpl() const { return *m; } + + DeclEnum* AddEnum(std::string fullname, DeclEnum decl); + DeclStruct* AddStruct(std::string fullname, DeclStruct decl); + + const DeclEnum* FindEnum(std::string_view name) const; + const DeclStruct* FindStruct(std::string_view name) const; + + DeclNamespace* AddNamespace(DeclNamespace ns); + + const DeclNamespace* FindNamespace(std::string_view fullname) const; + DeclNamespace* FindNamespace(std::string_view name); +}; -- cgit v1.2.3-70-g09d2