You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fbuild currently generates function prototypes for .ino preprocessing with regex-based extraction.
That is brittle for real C++ syntax, including templates, attributes, namespaces, multiline signatures, default arguments, comments, macros, references, qualifiers, and other common sketch patterns.
Relevant area:
crates/fbuild-build/src/source_scanner.rs
Proposal
Replace regex-based .ino function prototype generation with a clang AST-based implementation, or an equivalent parser-backed approach that is robust against normal C++ syntax.
The implementation should preserve Arduino/PlatformIO compatibility while avoiding accidental prototypes from control-flow statements, macros, lambdas, class methods, or invalid parse fragments.
Acceptance criteria
Prototype generation no longer depends on brittle regex matching.
Tests cover common Arduino sketch functions and complex C++ signatures.
Tests cover cases that should not produce prototypes, including lambdas, class methods, macros, control-flow blocks, and namespaced definitions.
Generated prototypes are stable across repeated runs.
Any clang dependency/runtime requirement is documented.
Open questions
Should this use clang directly, libclang bindings, clang tooling JSON output, or a smaller parser-backed compatibility layer?
How should parsing work before generated prototypes exist, given Arduino-style sketches may not be valid C++ yet?
Activity