update gencpp to latest

This commit is contained in:
ed
2024-12-14 07:12:35 -05:00
parent 2c66a62d55
commit 31c3e48236
4 changed files with 2481 additions and 2640 deletions
+3 -3
View File
@@ -46,13 +46,13 @@ The C/C++ interface procedures are located with `ast.hpp` (for the Code type), a
All code types can either serialize using a function of the pattern: All code types can either serialize using a function of the pattern:
```c ```c
StrBuilder <prefix>_to_string(Code code); StrBuilder <prefix>_to_strbuilder(Code code);
// or // or
<prefix>_to_string(Code code, StrBuilder& result); <prefix>_to_strbuilder(Code code, StrBuilder& result);
``` ```
Where the first generates strings allocated using Allocator_StringArena and the other appends an existing strings with their backed allocator. Where the first generates strings allocated using Allocator_StringArena and the other appends an existing strings with their backed allocator.
Serialization of for the AST is defined for `Code` in [`ast.chpp`](../base/components/ast.cpp) with `code_to_strbuilder_ptr` & `code_to_string`. Serialization of for the AST is defined for `Code` in [`ast.chpp`](../base/components/ast.cpp) with `code_to_strbuilder_ptr` & `code_to_strbuilder`.
Serializtion for the rest of the code types is within [`code_serialization.cpp`](../base/components/code_serialization.cpp). Serializtion for the rest of the code types is within [`code_serialization.cpp`](../base/components/code_serialization.cpp).
Gencpp's serialization does not provide coherent formatting of the code. The user should use a formatter after serializing. Gencpp's serialization does not provide coherent formatting of the code. The user should use a formatter after serializing.
+34 -34
View File
@@ -25,7 +25,7 @@ These are containers representing a scope body of a definition that can be of th
Fields: Fields:
```cpp ```cpp
StringCached Name; StrCached Name;
Code Front; Code Front;
Code Back; Code Back;
Token* Tok; Token* Tok;
@@ -56,8 +56,8 @@ Represent standard or vendor specific C/C++ attributes.
Fields: Fields:
```cpp ```cpp
StringCached Content; StrCached Content;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -80,8 +80,8 @@ Stores a comment.
Fields: Fields:
```cpp ```cpp
StringCached Content; StrCached Content;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -109,7 +109,7 @@ CodeComment InlineCmt; // Only supported by forward declarations
CodeAttributes Attributes; CodeAttributes Attributes;
CodeType ParentType; CodeType ParentType;
CodeBody Body; CodeBody Body;
StringCached Name; StrCached Name;
CodeType Prev; CodeType Prev;
CodeType Next; CodeType Next;
Token* Tok; Token* Tok;
@@ -143,7 +143,7 @@ CodeComment InlineCmt; // Only supported by forward declarations
Code InitializerList; Code InitializerList;
CodeParams Params; CodeParams Params;
Code Body; Code Body;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -178,8 +178,8 @@ Represents a preprocessor define
Fields: Fields:
```cpp ```cpp
StringCached Content; StrCached Content;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -201,7 +201,7 @@ Fields:
CodeComment InlineCmt; CodeComment InlineCmt;
CodeSpecifiers Specs; CodeSpecifiers Specs;
Code Body; Code Body;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -242,7 +242,7 @@ Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
Code Parent; Code Parent;
StringCached Name; StrCached Name;
CodeT Type; CodeT Type;
ModuleFlag ModuleFlags; ModuleFlag ModuleFlags;
``` ```
@@ -271,8 +271,8 @@ Will be obsolute when function body parsing is implemented.
Fields: Fields:
```cpp ```cpp
StringCached Content; StrCached Content;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -292,7 +292,7 @@ Fields:
```cpp ```cpp
CodeBody Body; CodeBody Body;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -314,8 +314,8 @@ extern "<Name>"
Fields: Fields:
```cpp ```cpp
StringCached Content; StrCached Content;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Code Parent; Code Parent;
@@ -338,7 +338,7 @@ Fields:
```cpp ```cpp
CodeComment InlineCmt; CodeComment InlineCmt;
Code Declaration; Code Declaration;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -363,7 +363,7 @@ CodeSpecifiers Specs;
CodeType ReturnType; CodeType ReturnType;
CodeParams Params; CodeParams Params;
CodeBody Body; CodeBody Body;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -390,7 +390,7 @@ Serialization:
Fields: Fields:
```cpp ```cpp
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -411,7 +411,7 @@ Fields:
```cpp ```cpp
CodeBody Body; CodeBody Body;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -440,7 +440,7 @@ CodeSpecifiers Specs;
CodeType ReturnType; CodeType ReturnType;
CodeParams Params; CodeParams Params;
CodeBody Body; CodeBody Body;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -472,7 +472,7 @@ CodeComment InlineCmt;
CodeSpecifiers Specs; CodeSpecifiers Specs;
CodeType ValueType; CodeType ValueType;
CodeBody Body; CodeBody Body;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -502,7 +502,7 @@ CodeType ValueType;
Code Macro; Code Macro;
Code Value; Code Value;
Code PostNameMacro; Code PostNameMacro;
StringCached Name; StrCached Name;
CodeParams Last; CodeParams Last;
CodeParams Next; CodeParams Next;
Token* Tok; Token* Tok;
@@ -524,8 +524,8 @@ Serialization:
Fields: Fields:
```cpp ```cpp
StringCached Content; StrCached Content;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -544,8 +544,8 @@ Serialization:
Fields: Fields:
```cpp ```cpp
StringCached Content; StrCached Content;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -566,7 +566,7 @@ Fields:
```cpp ```cpp
SpecifierT ArrSpecs[ AST_ArrSpecs_Cap ]; SpecifierT ArrSpecs[ AST_ArrSpecs_Cap ];
CodeSpecifiers NextSpecs; CodeSpecifiers NextSpecs;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -588,7 +588,7 @@ Fields:
```cpp ```cpp
CodeParams Params; CodeParams Params;
Code Declaration; Code Declaration;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -621,7 +621,7 @@ Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
Code Parent; Code Parent;
StringCached Name; StrCached Name;
CodeT Type; CodeT Type;
b32 IsParamPack; b32 IsParamPack;
ETypenameTag TypeTag; ETypenameTag TypeTag;
@@ -649,7 +649,7 @@ Fields:
```cpp ```cpp
CodeComment InlineCmt; CodeComment InlineCmt;
Code UnderlyingType; Code UnderlyingType;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok Token* Tok
@@ -682,7 +682,7 @@ Fields:
```cpp ```cpp
CodeAttributes Attributes; CodeAttributes Attributes;
CodeBody Body; CodeBody Body;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -708,7 +708,7 @@ Fields:
CodeComment InlineCmt; CodeComment InlineCmt;
CodeAttributes Attributes; CodeAttributes Attributes;
CodeType UnderlyingType; CodeType UnderlyingType;
StringCached Name; StrCached Name;
Code Prev; Code Prev;
Code Next; Code Next;
Token* Tok; Token* Tok;
@@ -740,7 +740,7 @@ CodeSpecifiers Specs;
CodeType ValueType; CodeType ValueType;
Code BitfieldSize; Code BitfieldSize;
Code Value; Code Value;
StringCached Name; StrCached Name;
CodeVar NextVar; CodeVar NextVar;
Code Prev; Code Prev;
Code Next; Code Next;
+3 -3
View File
@@ -63,7 +63,7 @@ int AST_ArrSpecs_Cap =
( (
AST_POD_Size AST_POD_Size
- sizeof(Code) - sizeof(Code)
- sizeof(StringCached) - sizeof(StrCached)
- sizeof(Code) * 2 - sizeof(Code) * 2
- sizeof(Token*) - sizeof(Token*)
- sizeof(Code) - sizeof(Code)
@@ -79,7 +79,7 @@ int AST_ArrSpecs_Cap =
Data Notes: Data Notes:
* The allocator definitions used are exposed to the user incase they want to dictate memory usage * The allocator definitions used are exposed to the user incase they want to dictate memory usage
* You'll find the memory handling in `init`, `deinit`, `reset`, `gen_strbuilder_allocator`, `get_cached_string`, `make_code`. * You'll find the memory handling in `init`, `deinit`, `reset`, `gen_strbuilder_allocator`, `cache_str`, `make_code`.
* Allocators are defined with the `AllocatorInfo` structure found in [`memory.hpp`](../base/dependencies/memory.hpp) * Allocators are defined with the `AllocatorInfo` structure found in [`memory.hpp`](../base/dependencies/memory.hpp)
* Most of the work is just defining the allocation procedure: * Most of the work is just defining the allocation procedure:
@@ -93,7 +93,7 @@ Data Notes:
* Cached Strings are stored in their own set of arenas. AST constructors use cached strings for names, and content. * Cached Strings are stored in their own set of arenas. AST constructors use cached strings for names, and content.
* `StringArenas`, `StringCache`, `Allocator_StringArena`, and `Allocator_StringTable` are the associated containers or allocators. * `StringArenas`, `StringCache`, `Allocator_StringArena`, and `Allocator_StringTable` are the associated containers or allocators.
* Strings used for serialization and file buffers are not contained by those used for cached strings. * Strings used for serialization and file buffers are not contained by those used for cached strings.
* They are currently using `GlobalAllocator`, which are tracked array of arenas that grows as needed (adds buckets when one runs out). * They are currently using `FallbackAllocator`, which are tracked array of arenas that grows as needed (adds buckets when one runs out).
* Memory within the buckets is not reused, so its inherently wasteful. * Memory within the buckets is not reused, so its inherently wasteful.
* I will be augmenting the default allocator with virtual memory & a slab allocator in the [future](https://github.com/Ed94/gencpp/issues/12) * I will be augmenting the default allocator with virtual memory & a slab allocator in the [future](https://github.com/Ed94/gencpp/issues/12)
* Intrusive linked lists used children nodes on bodies, and parameters. * Intrusive linked lists used children nodes on bodies, and parameters.
+2441 -2600
View File
File diff suppressed because it is too large Load Diff