[codex] Return hosted string accessors as string_view#29
Merged
Conversation
Emit immutable string field accessors as std::string_view when PROTOCYTE_ENABLE_STD_STRING_VIEW is enabled while preserving Span<const char> for default builds. Simplify Span<char> conversion to construct std::string_view directly from data and size, treating null non-empty spans as a contract violation. Regenerate checked smoke headers and add generator/smoke coverage for the hosted accessor surface.
Add smoke-driver-only fallback symbols for the MSVC debug STL CRT assertion hooks pulled in by std::string_view when PROTOCYTE_ENABLE_STD_STRING_VIEW is enabled. Route unexpected shim calls through DbgPrintEx and KeBugCheckEx, and cover the guard with a source-level regression test.
Owner
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Rely on the runtime header for PROTOCYTE_ENABLE_STD_STRING_VIEW accessor support instead of emitting a guarded string_view include from generated message headers. Keep string-constant headers self-contained when the opt-in macro is off by emitting string_view only under the inverse guard, and update checked smoke outputs.
Switch PROTOCYTE_ENABLE_STD_STRING_VIEW guards from definedness checks to value checks so -DPROTOCYTE_ENABLE_STD_STRING_VIEW=0 uses the non-string_view accessor path. Update inverse generated string constant includes, kernel smoke guards, documentation, tests, and regenerated smoke outputs.
Add protocyte::StringView as the runtime-selected string view type. Use the alias in generated immutable string accessors so string and oneof bodies are no longer duplicated across the string_view feature branch. Regenerate smoke checked outputs and update generator assertions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
stringaccessors asstd::string_viewwhenPROTOCYTE_ENABLE_STD_STRING_VIEWis set to a nonzero value, while preservingSpan<const char>for default and=0builds.<string_view>include; generated headers only include<string_view>for string constants when the runtime opt-in is disabled.Span<char>conversion to constructstd::string_viewdirectly fromdata_andsize_.std::string_viewinPROTOCYTE_ENABLE_STD_STRING_VIEW=1Debug driver builds.Test Plan
uv run python smoke/tools/generate_checked_outputs.pyclang-formaton touched C++ runtime/smoke filesuv run python -m compileall src testsuv run pytest -q(97 passed)ctest --test-dir smoke/build/msvc --output-on-failure(25/25 passed)protocyte_kernel_smoke) links