Skip to content

review comments#1

Open
GlynLeine wants to merge 65 commits intotmp_review_branchfrom
main
Open

review comments#1
GlynLeine wants to merge 65 commits intotmp_review_branchfrom
main

Conversation

@GlynLeine
Copy link
Member

No description provided.

NiZe42 and others added 30 commits August 28, 2025 10:36
Changed code style for whole solution.
There is circular dependency error.
…n-experiments

# Conflicts:
#	applications/reflection-experiments/src/reflection_parsers/ast_source_parser.cpp
#	applications/reflection-experiments/src/reflection_parsers/ast_source_parser.h
generated_path = std::filesystem::path(generate_folder) / compile_file.name.data();

rsl::dynamic_string final = get_gen_source_file(
rsl::dynamic_string::from_buffer(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a string_view instead. no need to dynamically allocate a string and copy over the data from the filesystem::path

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String view cannot be passed into ofstream file() as a parameter, so cannot exchange it into string_view


// Probably should consider different identifier, as name can be repeated in different namespaces.
std::string extracted_name = extract_name(compile_file.name.data());
file << "void register_reflection_file_" << extracted_name << "()\n";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could just do file << "void register_reflection_file_" << extract_name(compile_file.name.data()) << "()\n";
The compiler would probably optimize extracted_name away anyways, but currently the compiler is forced to actually create the std::string on the stack in debug mode.
by putting the extract_name function call inline you don't create a named variable. and thus the std::string can be created in-place in the file write stream operator call in debug as well.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to be used second time that function, so i think making it into a variable is usable

Comment on lines +136 to +145
char buffer[256];
std::memcpy(buffer, source_location.data(), source_location.size());
buffer[source_location.size()] = '\0';

char* last_dot = std::strrchr(buffer, '.');
if(last_dot != nullptr) { *last_dot = '\0'; }

strcat_s(buffer, "_generated.cpp");

return rsl::dynamic_string::from_buffer(buffer, std::strlen(buffer) + 1);
Copy link
Member Author

@GlynLeine GlynLeine Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using rsl::operator""_sv;
source_location = source_location.subview(0ull, rsl::reverse_linear_search(source_location, '.'));

return rsl::dynamic_string::from_view(source_location) + "_generated.cpp"_sv

Comment on lines +24 to +25
[[nodiscard]] const std::vector<std::unique_ptr<compile_reflected_class>>&
get_class_container() const;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function name would logically to me return a compile_reflection_container<compile_reflected_class> so maybe get_sub_classes would be a better name.

It's probably also better to return a std::span<const std::unique_ptr<compile_reflected_class>> instead if you want to give read access without giving implementation details.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that that the name should stay consistent with different functions like that, like get_function container and get_variable_container.

Have changed into spans

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants