aboutsummaryrefslogtreecommitdiff
path: root/source/20-codegen-compiler/CodegenModel.hpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2022-07-17 23:09:00 -0700
committerrtk0c <[email protected]>2022-07-17 23:09:00 -0700
commit8c2b1bd5bd85667a2ea24ec3aa85cbdd97f9ea1c (patch)
tree80b12277b667747aa4f18ebcc3931c2ea618cb1e /source/20-codegen-compiler/CodegenModel.hpp
parentc6e57dc94e532442ffa0bd57a16206217adbca92 (diff)
Changeset: 85 Work on codegen (a big blob of changes about various things, giving up on writing a clear commit message)
- stuff along the lines of cleaning up store process - remove completed TODOs - move code generation out of parser loop - ^^^ also introduce some weird bugs of DeclXxx::name field disappearing -- maybe fixed, maybe didn't, can't reliably reproduce - add infra to mangle (not included in codegen yet, also not tested) - convert SourceFile storage map to node map, ensuring pointer stability (was broken before) - buildsystem asan and UBsan applying to all targest
Diffstat (limited to 'source/20-codegen-compiler/CodegenModel.hpp')
-rw-r--r--source/20-codegen-compiler/CodegenModel.hpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/source/20-codegen-compiler/CodegenModel.hpp b/source/20-codegen-compiler/CodegenModel.hpp
index 31ca04f..99c345d 100644
--- a/source/20-codegen-compiler/CodegenModel.hpp
+++ b/source/20-codegen-compiler/CodegenModel.hpp
@@ -2,22 +2,25 @@
#include "CodegenConfig.hpp"
#include "CodegenDecl.hpp"
+#include "CodegenModel.hpp"
#include "CodegenUtils.hpp"
+#include <sqlite3.h>
#include <cinttypes>
+#include <cstdint>
#include <string>
#include <string_view>
using namespace std::literals;
-class CodegenModel {
+class CodegenRuntimeModel {
private:
class Private;
Private* m;
public:
- CodegenModel();
- ~CodegenModel();
+ CodegenRuntimeModel();
+ ~CodegenRuntimeModel();
// Implementation detail helper, don't use outside
Private& GetPimpl() const { return *m; }
@@ -33,3 +36,26 @@ public:
const DeclNamespace* FindNamespace(std::string_view fullname) const;
DeclNamespace* FindNamespace(std::string_view name);
};
+
+class CodegenArchiveModel {
+private:
+ class Private;
+ Private* m;
+
+public:
+ CodegenArchiveModel(std::string_view dbPath);
+ ~CodegenArchiveModel();
+
+ // Implementation detail helper, don't use outside
+ Private& GetPimpl() const { return *m; }
+
+ void DeleteDeclsRelatedToFile(std::string_view filename);
+
+ void Store(const CodegenRuntimeModel& model);
+ void LoadInto(CodegenRuntimeModel& model) const;
+ CodegenRuntimeModel Load() const;
+
+ void StoreStruct(const DeclStruct& decl);
+ void StoreFunction(const DeclFunction& decl);
+ void StoreEnum(const DeclEnum& decl);
+};