diff options
author | rtk0c <[email protected]> | 2022-07-18 10:24:01 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-07-18 10:24:01 -0700 |
commit | 4067db383fb17d0580ebdc41e6354a84898e8343 (patch) | |
tree | e7f36bbd1992ea14916e7387dfcdd050807e23e1 /source/20-codegen-compiler/CodegenDecl.hpp | |
parent | a78bffc3a8ca4dfe6ca985223e38d28608184c52 (diff) |
Changeset: 87 Make codegen use mangled names, convert `std::string_view fullname` to `const std::string* fullname` to indicate the reference nature better
Diffstat (limited to 'source/20-codegen-compiler/CodegenDecl.hpp')
-rw-r--r-- | source/20-codegen-compiler/CodegenDecl.hpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source/20-codegen-compiler/CodegenDecl.hpp b/source/20-codegen-compiler/CodegenDecl.hpp index eacd254..e645323 100644 --- a/source/20-codegen-compiler/CodegenDecl.hpp +++ b/source/20-codegen-compiler/CodegenDecl.hpp @@ -23,7 +23,7 @@ struct DeclNamespace { DeclNamespace* container = nullptr; std::string name; - std::string_view fullname; // View into storage map key + const std::string* fullname = nullptr; // View into storage map key }; struct DeclStruct; @@ -52,12 +52,14 @@ struct DeclStruct { std::vector<DeclMemberFunction> generatedFunctions; std::string name; mutable std::string mangledName; - std::string_view fullname; + const std::string* fullname = nullptr; // View into storage map key // Scanned generation options bool generating : 1 = false; bool generatingInheritanceHiearchy : 1 = false; + const std::string& GetName() const { return name; } + const std::string& GetFullName() const { return *fullname; } const std::string& GetMangledName() const; }; @@ -97,7 +99,7 @@ struct DeclEnum { DeclNamespace* container = nullptr; std::string name; mutable std::string mangledName; - std::string_view fullname; + const std::string* fullname = nullptr; // View into storage map key std::vector<DeclEnumElement> elements; EnumUnderlyingType underlyingType; // Start with invalid value, calculate on demand @@ -114,7 +116,7 @@ struct DeclEnum { bool generateExcludeUseHeuristics : 1 = false; const std::string& GetName() const { return name; } - std::string_view GetFullName() const { return fullname; } + const std::string& GetFullName() const { return *fullname; } const std::string& GetMangledName() const; std::string_view GetUnderlyingTypeName() const; @@ -134,7 +136,7 @@ struct DeclFunction { // Things like extern, static, etc. that gets written before the function return type std::string prefix; std::string name; - std::string_view fullname; + const std::string* fullname = nullptr; // View into storage map key std::string returnType; std::vector<DeclFunctionArgument> arguments; std::string body; |