aboutsummaryrefslogtreecommitdiff
path: root/buildtools/codegen/CodegenInput.inl
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2022-05-30 17:03:20 -0700
committerrtk0c <[email protected]>2022-05-30 17:03:20 -0700
commite66286ebe30afc9acc4531fc2bea29b7fb924f93 (patch)
treefa6b76554c3eb88bc8f088fbab68e20c40118ca7 /buildtools/codegen/CodegenInput.inl
parent366ef5a5450c6e0e680c924c3454943a9ae9814d (diff)
Changeset: 56 Buildsystem cleanup: change to layered structure for different targets
Diffstat (limited to 'buildtools/codegen/CodegenInput.inl')
-rw-r--r--buildtools/codegen/CodegenInput.inl69
1 files changed, 0 insertions, 69 deletions
diff --git a/buildtools/codegen/CodegenInput.inl b/buildtools/codegen/CodegenInput.inl
deleted file mode 100644
index 0809e7f..0000000
--- a/buildtools/codegen/CodegenInput.inl
+++ /dev/null
@@ -1,69 +0,0 @@
-#pragma once
-
-#include "CodegenConfig.hpp"
-#include "CodegenDecl.hpp"
-
-#include "CodegenUtils.inl"
-
-#include <Utils.hpp>
-
-#include <robin_hood.h>
-#include <cinttypes>
-#include <string>
-#include <string_view>
-#include <vector>
-
-using namespace std::literals;
-
-class CodegenInput {
-private:
- std::vector<DeclEnum> mEnums;
- robin_hood::unordered_flat_map<std::string, size_t, StringHash, StringEqual> mDeclByName;
- robin_hood::unordered_node_map<std::string, DeclNamespace, StringHash, StringEqual> mNamespaces;
-
-public:
- void AddEnum(std::string fullname, DeclEnum decl) {
-#if CODEGEN_DEBUG_PRINT
- printf("Committed enum '%s'\n", decl.name.c_str());
- for (auto& elm : decl.elements) {
- printf(" - element %s = %" PRId64 "\n", elm.name.c_str(), elm.value);
- }
-#endif
-
- mDeclByName.try_emplace(std::move(fullname), mEnums.size());
- mEnums.push_back(std::move(decl));
- }
-
- DeclNamespace* AddNamespace(DeclNamespace ns) {
- auto path = Utils::MakeFullName(""sv, &ns);
- auto [iter, success] = mNamespaces.try_emplace(std::move(path), std::move(ns));
- auto& nsRef = iter->second;
- if (success) {
- nsRef.fullname = iter->first;
- }
- return &nsRef;
- }
-
- const DeclEnum* FindEnumByName(std::string_view name) const {
- // TODO handle multiple kinds of decl
- auto iter = mDeclByName.find(name);
- if (iter != mDeclByName.end()) {
- return &mEnums[iter->second];
- } else {
- return nullptr;
- }
- }
-
- const DeclNamespace* FindNamespace(std::string_view fullname) const {
- auto iter = mNamespaces.find(fullname);
- if (iter != mNamespaces.end()) {
- return &iter->second;
- } else {
- return nullptr;
- }
- }
-
- DeclNamespace* FindNamespace(std::string_view name) {
- return const_cast<DeclNamespace*>(const_cast<const CodegenInput*>(this)->FindNamespace(name));
- }
-};