List of functions in the ude.parsers.native_cpp_reparse namespace.

Entity NameDescription
_tokens_after_extent
function_prefix_phantom_macrosIf cursor is the phantom head of a function declaration (an int-typed VAR/FIELD decl directly followed by [<IDENT>...] <name> (), return the ALL_CAPS prefix macro names that must be defined empty for clang to parse the real declaration (possibly an empty list). Return None when it is not such a phantom.
_top_level_main_file_cursorsEvery cursor located in main_path, as a list (compute once per file).
conditional_line_depthsPreprocessor-conditional nesting depth at every line (index = line number, 1-based; index 0 unused), NOT counting a file-wide include guard.
count_main_file_cursorsNumber of cursors located in main_path – the acceptance check for a re-parse: a stub that conflicts with a real declaration drops declarations, so the second parse is only used when this count did not shrink.
_split_template_headtokens[start] is template; return (index after the matching ‘>’, set of template-parameter names) or None.
_main_file_tokens
main_file_cursorsPublic alias of the pruned main-file cursor walk (compute once per file).
undeclared_specialization_argsUnqualified identifiers used as template arguments of a `template<…> struct
build_stub_headerStub header text for a second parse of main_path, or None when the file shows no recognised symptom (the common case: no second parse, no cost).
_spelled_textJoins tokens with a space only where the source had a gap.
_classify_blockKind of the { block whose statement-header tokens (spelling strings) are header: ’ns’ (namespace / extern “C”), ‘class’ (struct/class/union definition) or ‘other’ (function body, enum, initializer, lambda, …).
_enclosing_block_kindsFor each token index in positions, the outer->inner list of enclosing {} block kinds.
find_dropped_type_aliasesusing NAME = <type>; declarations in main_path that libclang DROPPED (no alias cursor at all) because the right-hand side names an undeclared type – the same silent drop as the specialization case in the module docstring (real: microsoft/terminal’s using FromJsonResult = std::tuple<Model::IActionArgs, ...> with IActionArgs only visible through a generated header). An alias has no members, so it can be built straight from its tokens.

Generated with Flude

Copyright © 2026

Directory & Entity Index

Entity NameSummary / Description
_classify_block function

Kind of the { block whose statement-header tokens (spelling strings) are header: ’ns’ (namespace / extern “C”), ‘class’ (struct/class/union definition) or ‘other’ (function body, enum, initializer, lambda, …).

Methods

_classify_block

_classify_block(header: list) -> str

Kind of the { block whose statement-header tokens (spelling strings) are header: ’ns’ (namespace / extern “C”), ‘class’ (struct/class/union definition) or ‘other’ (function body, enum, initializer, lambda, …).

ParameterTypeDescription
headerlist

Generated with Flude

_enclosing_block_kinds function

For each token index in positions, the outer->inner list of enclosing {} block kinds.

Methods

_enclosing_block_kinds

_enclosing_block_kinds(tokens: list, positions: Set) -> dict

For each token index in positions, the outer->inner list of enclosing {} block kinds.

ParameterTypeDescription
tokenslist
positionsSet

Generated with Flude

Copyright © 2026

_main_file_tokens function

Methods

_main_file_tokens

_main_file_tokens(tu, main_path: str) -> list

ParameterTypeDescription
tuAny
main_pathstr

Generated with Flude

Copyright © 2026

_spelled_text function

Joins tokens with a space only where the source had a gap.

Methods

_spelled_text

_spelled_text(tokens: list) -> str

Joins tokens with a space only where the source had a gap.

ParameterTypeDescription
tokenslist

Generated with Flude

Copyright © 2026

_split_template_head function

tokens[start] is template; return (index after the matching ‘>’, set of template-parameter names) or None.

Methods

_split_template_head

_split_template_head(tokens: list, start: int)

tokens[start] is template; return (index after the matching ‘>’, set of template-parameter names) or None.

ParameterTypeDescription
tokenslist
startint

Generated with Flude

Copyright © 2026

_tokens_after_extent function

Methods

_tokens_after_extent

_tokens_after_extent(tu, cursor, limit: int) -> list

ParameterTypeDescription
tuAny
cursorAny
limitint

Generated with Flude

Copyright © 2026

_top_level_main_file_cursors function

Every cursor located in main_path, as a list (compute once per file).

Subtrees rooted in OTHER files are never descended into: a TU built on a PCH carries the whole Windows SDK / STL (millions of cursors), and walking all of it three times per file made a full microsoft/terminal run take >3x longer. A cursor in main_path can only sit under cursors that are themselves in main_path (each reopened namespace block is its own cursor), so pruning loses nothing. Iterative on purpose: this runs inside worker threads with small stacks and real ASTs can nest very deeply.

build_stub_header function

Stub header text for a second parse of main_path, or None when the file shows no recognised symptom (the common case: no second parse, no cost).

Methods

build_stub_header

build_stub_header(tu, main_path: str) -> Optional[str]

Stub header text for a second parse of main_path, or None when the file shows no recognised symptom (the common case: no second parse, no cost).

ParameterTypeDescription
tuAny
main_pathstr

Generated with Flude

conditional_line_depths function

Preprocessor-conditional nesting depth at every line (index = line number, 1-based; index 0 unused), NOT counting a file-wide include guard.

libclang’s get_tokens returns the tokens of INACTIVE #if branches too (it only lexes), so a declaration scan over tokens would otherwise resurrect code the build never compiles (seen: btop’s FreeBSD-only KvmPtr, xgboost’s CUDA nvtx::*, a Windows-only ssize_t). Recovery is conservatively limited to depth 0, which also skips declarations inside active #ifs – a deliberate loss of recall, never a false positive.

count_main_file_cursors function

Number of cursors located in main_path – the acceptance check for a re-parse: a stub that conflicts with a real declaration drops declarations, so the second parse is only used when this count did not shrink.

Methods

count_main_file_cursors

count_main_file_cursors(tu, main_path: str) -> int

Number of cursors located in main_path – the acceptance check for a re-parse: a stub that conflicts with a real declaration drops declarations, so the second parse is only used when this count did not shrink.

find_dropped_type_aliases function

using NAME = <type>; declarations in main_path that libclang DROPPED (no alias cursor at all) because the right-hand side names an undeclared type – the same silent drop as the specialization case in the module docstring (real: microsoft/terminal’s using FromJsonResult = std::tuple<Model::IActionArgs, ...> with IActionArgs only visible through a generated header). An alias has no members, so it can be built straight from its tokens.

Returns dicts {name, aliased_type, scope, owner_is_class, access, line}: scope is the list of enclosing namespace/class names outer->inner (anonymous namespaces skipped, same as the backend’s own path logic), access the class access label in force (None for a namespace owner). using namespace X;, using X::y; and alias templates are skipped.

function_prefix_phantom_macros function

If cursor is the phantom head of a function declaration (an int-typed VAR/FIELD decl directly followed by [<IDENT>...] <name> (), return the ALL_CAPS prefix macro names that must be defined empty for clang to parse the real declaration (possibly an empty list). Return None when it is not such a phantom.

Methods

function_prefix_phantom_macros

function_prefix_phantom_macros(tu, cursor) -> Optional[List[str]]

If cursor is the phantom head of a function declaration (an int-typed VAR/FIELD decl directly followed by [<IDENT>...] <name> (), return the ALL_CAPS prefix macro names that must be defined empty for clang to parse the real declaration (possibly an empty list). Return None when it is not such a phantom.

main_file_cursors function

Public alias of the pruned main-file cursor walk (compute once per file).

Methods

main_file_cursors

main_file_cursors(tu, main_path: str) -> List

Public alias of the pruned main-file cursor walk (compute once per file).

ParameterTypeDescription
tuAny
main_pathstr

Generated with Flude

Copyright © 2026

undeclared_specialization_args function

Unqualified identifiers used as template arguments of a template&lt;...&gt; struct|class| union Name&lt;args&gt; { specialization in main_path that has NO matching class cursor (the libclang drop described in the module docstring).

Methods

undeclared_specialization_args

undeclared_specialization_args(tu, main_path: str, cursors: Optional) -> List[str]

Unqualified identifiers used as template arguments of a template&lt;...&gt; struct|class| union Name&lt;args&gt; { specialization in main_path that has NO matching class cursor (the libclang drop described in the module docstring).

ParameterTypeDescription
tuAny
main_pathstr
cursorsOptional

Generated with Flude