diff --git a/.gitignore b/.gitignore
index 7680460..3df6aee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,3 +28,4 @@ release/**
**/Unreal/*.cpp
! **/Unreal/validate.unreal.cpp
project/auxillary/vis_ast/dependencies/temp
+test/gen/original
diff --git a/.vscode/settings.json b/.vscode/settings.json
index a8ac376..1e55a3a 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -36,7 +36,8 @@
"mmsystem.h": "c",
"propidl.h": "c",
"android_native_app_glue.h": "c",
- "raylib.h": "c"
+ "raylib.h": "c",
+ "*.m": "cpp"
},
"C_Cpp.intelliSenseEngineFallback": "disabled",
"mesonbuild.configureOnOpen": true,
diff --git a/gencpp.10x b/gencpp.10x
index 5940354..727ea92 100644
--- a/gencpp.10x
+++ b/gencpp.10x
@@ -43,6 +43,7 @@
GEN_TIME
GEN_SYSTEM_WINDOWS
GEN_INTELLISENSE_DIRECTIVES
+ GEN_EXECUTION_EXPRESSION_SUPPORT
diff --git a/scripts/build.ci.ps1 b/scripts/build.ci.ps1
index c3f6c25..acaabbe 100644
--- a/scripts/build.ci.ps1
+++ b/scripts/build.ci.ps1
@@ -164,9 +164,13 @@ if ( $singleheader )
if ( $test )
{
- $path_gen = join-path $path_test gen
- $path_gen_build = join-path $path_gen build
- $path_build = join-path $path_test build
+ $path_gen = join-path $path_test gen
+ $path_gen_build = join-path $path_gen build
+ $path_build = join-path $path_test build
+ $path_original = join-path $path_gen original
+ $path_components = join-path $path_original components
+ $path_dependencies = join-path $path_original dependencies
+ $path_helpers = join-path $path_original helpers
if ( -not(Test-Path($path_build) )) {
New-Item -ItemType Directory -Path $path_build
@@ -177,6 +181,18 @@ if ( $test )
if ( -not(Test-Path($path_gen_build) )) {
New-Item -ItemType Directory -Path $path_gen_build
}
+ if ( -not(test-path $path_original)) {
+ new-item -ItemType Directory -Path $path_original
+ }
+ if ( -not(test-path $path_components)) {
+ new-item -ItemType Directory -Path $path_components
+ }
+ if ( -not(test-path $path_dependencies)) {
+ new-item -ItemType Directory -Path $path_dependencies
+ }
+ if ( -not(test-path $path_helpers)) {
+ new-item -ItemType Directory -Path $path_helpers
+ }
$path_bootstrap = join-path $path_project gen
diff --git a/scripts/gencpp.natvis b/scripts/gencpp.natvis
index 09c3b67..00222f9 100644
--- a/scripts/gencpp.natvis
+++ b/scripts/gencpp.natvis
@@ -671,11 +671,11 @@
-
+
Length:{Length} Text:{Text, [Length]s} Type:{Type}
-
+
Current[ { Arr[Idx] } ] Idx:{ Idx }
diff --git a/test/CURSED_TYPEDEF.h b/test/CURSED_TYPEDEF.h
index c2bad60..5893982 100644
--- a/test/CURSED_TYPEDEF.h
+++ b/test/CURSED_TYPEDEF.h
@@ -1,4 +1,5 @@
#include
+#include
class MyClass;
@@ -24,12 +25,20 @@ struct TemplateStruct {
int specialMember[10];
};
-typedef decltype(nullptr) (MyClass::*InsaneComplexTypeDef)(
- decltype((MyEnum::VAL1 == MyEnum::VAL2) ? 1 : 2.0)
- (TemplateStruct::*ptr)[5][alignof(double)],
- std::function&&,
- void (MyClass::*memFnPtr)(TemplateStruct))>,
+template
+struct AnotherTemplate {
+ T value;
+};
+
+typedef decltype(nullptr) (MyClass::*InsaneComplexTypeDef)
+(
+ decltype((MyEnum::VAL1 == MyEnum::VAL2) ? 1 : 2.0)(TemplateStruct::*ptr)[5][alignof(double)],
+ std::function&&, void (MyClass::*memFnPtr)(TemplateStruct))>,
int (MyClass::*&refToMemFnPtr)(TemplateStruct),
int (TemplateStruct::*memberPointer)[10],
- char&&...
-) volatile const && noexcept;
+ typename std::tuple_element<0, std::tuple>>>::type::*complexMember,
+ template typename AnotherTemplate::*templateMember
+ char&&...,
+)
+volatile const && noexcept;
+
\ No newline at end of file
diff --git a/test/test.cpp b/test/test.cpp
index 405b160..b784a90 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -7,6 +7,7 @@
#include "gen.builder.cpp"
#include "sanity.cpp"
#include "SOA.cpp"
+#include "validate.original.cpp"
#include "validate.singleheader.cpp"
int gen_main()
@@ -18,7 +19,9 @@ int gen_main()
// check_SOA();
- check_singleheader_ast();
+ validate_original_files_ast();
+ validate_singleheader_ast();
+
return 0;
}
#endif
diff --git a/test/validate.original.cpp b/test/validate.original.cpp
new file mode 100644
index 0000000..0041d31
--- /dev/null
+++ b/test/validate.original.cpp
@@ -0,0 +1,159 @@
+
+#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
+#define GEN_ENFORCE_STRONG_CODE_TYPES
+#define GEN_EXPOSE_BACKEND
+#define GEN_BENCHMARK
+#include "gen.hpp"
+#include "gen.builder.hpp"
+#include "gen.scanner.hpp"
+using namespace gen;
+
+#ifdef GEN_SYSTEM_WINDOWS
+ #include
+#endif
+
+#define path_root "../"
+#define path_project path_root "project/"
+#define path_scripts path_root "scripts/"
+#define path_components path_project "components/"
+#define path_generated path_components "gen/"
+#define path_dependencies path_project "dependencies/"
+#define path_helpers path_project "helpers/"
+
+void validate_file_ast( char const* path, char const* path_gen )
+{
+ log_fmt( "\nValidating: %s", path );
+
+ FileContents file = file_read_contents( GlobalAllocator, true, path );
+ u64 time_start = time_rel_ms();
+ CodeBody ast = parse_global_body( { file.size, (char const*)file.data } );
+ log_fmt("\n\tAst generated. Time taken: %llu ms", time_rel_ms() - time_start);
+
+ log_fmt("\n\tSerializng ast:\n");
+ time_start = time_rel_ms();
+ Builder
+ builder = Builder::open( path_gen );
+ builder.print( ast );
+ builder.write();
+ log_fmt("\tSerialized. Time taken: %llu ms", time_rel_ms() - time_start);
+
+ // Need to execute clang format on the generated file to get it to match the original.
+ #define clang_format "clang-format "
+ #define cf_format_inplace "-i "
+ #define cf_style "-style=file:" "C:/projects/gencpp/scripts/.clang-format "
+ #define cf_verbose "-verbose "
+ String command = String::make( GlobalAllocator, clang_format );
+ command.append( cf_format_inplace );
+ command.append( cf_style );
+ command.append( cf_verbose );
+ command.append( path_gen );
+ log_fmt("\n\tRunning clang-format on generated file:\n");
+ system( command );
+ log_fmt("\tclang-format finished reformatting.");
+ #undef cf_cmd
+ #undef cf_format_inplace
+ #undef cf_style
+ #undef cf_verbse
+
+ FileContents file_gen = file_read_contents( GlobalAllocator, true, path_gen );
+ log_fmt("\n\tReconstructing from generated file:");
+ time_start = time_rel_ms();
+ CodeBody ast_gen = parse_global_body( { file_gen.size, (char const*)file_gen.data } );
+ log_fmt("\n\tAst generated. Time taken: %llu ms", time_rel_ms() - time_start);
+
+ time_start = time_rel_ms();
+
+ if ( ast.is_equal( ast_gen ) )
+ log_fmt( "\n\tPassed!: AST passed validation! " );
+ else
+ log_fmt( "\nFailed: AST did not pass validation " );
+
+ log_fmt( "Time taken: %llu ms\n", time_rel_ms() - time_start );
+}
+
+void validate_original_files_ast()
+{
+ gen::init();
+ log_fmt("\nvalidate_original_files_ast:\n");
+
+ PreprocessorDefines.append( get_cached_string( txt("GEN_DEF_INLINE") ));
+ PreprocessorDefines.append( get_cached_string( txt("GEN_IMPL_INLINE") ));
+
+ // Helpers
+ {
+ #define validate( path ) validate_file_ast( path_helpers path, "gen/original/helpers/" path );
+ validate( "push_ignores.inline.hpp" );
+ validate( "pop_ignores.inline.hpp" );
+ #undef validate
+ }
+
+ // Dependencies
+ {
+ #define validate( path ) validate_file_ast( path_dependencies path, "gen/original/dependencies/" path )
+ validate( "header_start.hpp" );
+ validate( "macros.hpp" );
+ validate( "basic_types.hpp" );
+ validate( "debug.hpp" );
+ validate( "memory.hpp" );
+ validate( "string_ops.hpp" );
+ validate( "printing.hpp" );
+ validate( "containers.hpp" );
+ validate( "hashing.hpp" );
+ validate( "strings.hpp" );
+ validate( "filesystem.hpp" );
+ validate( "timing.hpp" );
+
+ validate( "src_start.cpp" );
+ validate( "debug.cpp" );
+ validate( "string_ops.cpp" );
+ validate( "printing.cpp" );
+ validate( "memory.cpp" );
+ validate( "hashing.cpp" );
+ validate( "strings.cpp" );
+ validate( "filesystem.cpp" );
+ validate( "timing.cpp" );
+
+ validate( "parsing.cpp" );
+ validate( "parisng.hpp" );
+ #undef validate
+ }
+
+ // Components
+ {
+ #define validate( path ) validate_file_ast( path_components path, "gen/original/components/" path )
+ validate( "header_start.hpp" );
+ validate( "types.hpp" );
+ validate( "gen/ecode.hpp" );
+ validate( "gen/eoperator.hpp" );
+ validate( "gen/especifier.hpp" );
+ validate( "ast.hpp" );
+ validate( "code_types.hpp" );
+ validate( "ast_types.hpp" );
+ validate( "interface.hpp" );
+ validate( "inlines.hpp" );
+ validate( "gen/ast_inlines.hpp" );
+ validate( "header_end.hpp" );
+
+ validate( "static_data.cpp" );
+ validate( "ast_case_macros.cpp" );
+ validate( "ast.cpp" );
+ validate( "code_serialization.cpp" );
+ validate( "interface.cpp" );
+ validate( "interface.upfront.cpp" );
+ validate( "gen/etoktype.cpp" );
+ validate( "lexer.cpp" );
+ validate( "parser.cpp" );
+ validate( "interface.parsing.cpp" );
+ validate( "interface.untyped.cpp" );
+ #undef validate
+ }
+
+ gen::deinit();
+}
+
+#undef path_root
+#undef path_project
+#undef path_scripts
+#undef path_components
+#undef path_generated
+#undef path_dependencies
diff --git a/test/validate.singleheader.cpp b/test/validate.singleheader.cpp
index b9d252b..7ca3670 100644
--- a/test/validate.singleheader.cpp
+++ b/test/validate.singleheader.cpp
@@ -11,11 +11,11 @@ using namespace gen;
#include
#endif
-void check_singleheader_ast()
+void validate_singleheader_ast()
{
#define root_dir "../"
gen::init();
- log_fmt("\ncheck_singleheader_ast:\n");
+ log_fmt("\validate_singleheader_ast:\n");
FileContents file = file_read_contents( GlobalAllocator, true, root_dir "singleheader/gen/gen.hpp" );
u64 time_start = time_rel_ms();