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.

Methods

conditional_line_depths

conditional_line_depths(main_path: str) -> List[int]

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.

ParameterTypeDescription
main_pathstr

Generated with Flude

Copyright © 2026