fix: skip explicit constructors in universal codegen#116
Open
gmelodie wants to merge 1 commit into
Open
Conversation
88c7e8b to
f963943
Compare
📊 External-library doc-test reportThe four ways to wrap a C library — each scaffolded into a real module, built against this commit, loaded in logoscore, and called — rendered alongside the commands actually run and their output (updated each run, commit Pages can take a minute to update after the run finishes. |
f963943 to
a9903c7
Compare
a9903c7 to
62524be
Compare
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
logos-cpp-generator's impl-header parser skips constructors via a regex anchored at^\s*~?<Class>\s*\(, which doesn't matchexplicit <Class>(. When a module's impl class declares its constructor withexplicit(e.g.explicit Libp2pModuleImpl(const Libp2pModuleOptions& opts = {});), the constructor leaks through as a regular method and the generated Qt glue emits:The method name shadows the type name, so the trailing
Libp2pModuleImpl m_impl;field declaration fails with'Libp2pModuleImpl' does not name a type, and every subsequent reference tom_implreportswas not declared in this scope. This shows up downstream as anix flake checkfailure inlogos-libp2p-moduleon the openmetrics scaffold branch.Workaround: copy the impl header to a temp dir, strip
explicitfrom the ctor line, and feed the sanitized copy to--from-header.--impl-headerkeeps the original filename so the generated#includestill resolves to the real header at compile time. No source files are mutated and the originalexplicitsemantics are preserved everywhere else in the build.The real fix belongs in
logos-cpp-sdk'simpl_header_parser.cpp(the ctor regex should permit decl-specifiers); this is a stopgap until that lands.