mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-04 18:58:00 +00:00
Implement a tree-sitter-based type evaluator for C/C++ that resolves method calls, template instantiations, and cross-file references without requiring a full compiler. Covers ~95% of C and ~93% of moderate C++. Key features: - Type-aware overload resolution scoring by parameter types - Lambda return type inference (trailing return + body deduction) - Inline namespace normalization (__1, __cxx11, __gnu_cxx) - Implicit conversions (char*->string, numeric promotions) - Virtual dispatch with override preference - CRTP detection and self-type resolution - Range-for iterator protocol (maps, custom containers) - Smart pointer arrow dispatch (unique_ptr, shared_ptr) - Dependent member calls in templates via pending call resolution - Explicit template argument substitution (make_shared<T>) - Nested class scope resolution - C/C++ stdlib type stubs (containers, strings, I/O, smart ptrs) - Cross-file LSP with compile_commands.json support - C/C++ parameter extraction via declarator chain traversal 63+ test cases covering all resolution strategies.
31 lines
854 B
C
31 lines
854 B
C
#ifndef CBM_PREPROCESSOR_H
|
|
#define CBM_PREPROCESSOR_H
|
|
|
|
#include <stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
// Preprocess C/C++ source: expand macros, evaluate #ifdef, resolve #include.
|
|
// Returns malloc-allocated expanded source, or NULL if no expansion needed/on failure.
|
|
// extra_defines: NULL-terminated array of "NAME=VALUE" strings (can be NULL).
|
|
// include_paths: NULL-terminated array of directory paths for #include resolution (can be NULL).
|
|
// The returned string must be freed with cbm_preprocess_free().
|
|
char* cbm_preprocess(
|
|
const char* source, int source_len,
|
|
const char* filename,
|
|
const char** extra_defines,
|
|
const char** include_paths,
|
|
int cpp_mode
|
|
);
|
|
|
|
// Free preprocessed source returned by cbm_preprocess.
|
|
void cbm_preprocess_free(char* expanded);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // CBM_PREPROCESSOR_H
|