Skip to main content

Module declarations

Module declarations 

Source
Expand description

The C++ declaration walk, including the macro-sentinel error recovery.

Every function here is a pure function of a parsed tree and its source text. analyzer/cpp/adapter.rs in brokk-bifrost-analysis drives CppVisitor out of LanguageAdapter::parse_file.

Structs§

CppSentinelRecoveredClass
CppSentinelRecoveredOwner
Owned structural recovery metadata for a namespace-sentinel region.
CppVisitor
ScopeInfo

Functions§

collect_cpp_identifiers
cpp_displaced_preprocessor_terminator
The real #endif that tree-sitter consumed inside an error subtree.
cpp_export_macro_token
cpp_field_declaration_linkage
Classify a C++ field while its declaration syntax is already available.
cpp_file_using_namespaces
Every using namespace X; directive target in a file, in source order, for resolution-time consumers that need the file’s using-directives without the per-position scope threading extraction does. Parses source fresh and walks the tree structurally, reusing cpp_using_namespace_target (which keys on the grammar’s namespace keyword token, not source text), so it never misreads a member-importing using X::Y; as a namespace directive.
cpp_member_fq
Structured name for a member unit (function, field, enumerator). The short_name is the owning $-joined nested-class Type chain followed, when the member has an owner, by .member; free functions and globals have no owner and no ., so the whole short_name is the terminal SegmentKind::Member. C++ member names never contain a literal ., so the single . (if any) separates the owner chain from the member.
cpp_sentinel_recovered_classes
Recover the class and out-of-line owner scopes from every malformed namespace-sentinel region in root.
cpp_sentinel_recovered_scope_for_node
Resolve the lexical scope restored for a node in a malformed namespace-sentinel region. Owner spans (out-of-line member definitions) outrank class spans, which in turn outrank the surviving namespace body. The class ancestor suffix is recovered from the original CST so nested members keep their complete Outer::Inner owner chain.
cpp_template_term
is_direct_recovered_exported_class_field_declaration
is_recovered_exported_class_container
node_text
normalize_cpp_whitespace
recover_quoted_includes
recovered_exported_class_has_body
recovered_macro_return_type_node
Recognize the phantom field tree-sitter emits for a macro-qualified function return type. For example, static API result_type ThresholdForSmallA() { ... } can become a field_declaration (API as the type and result_type as a field name) followed by a clean function_definition for ThresholdForSmallA.