GitNexus/gitnexus/test
Kareem Albaba 780029e288 feat(extractors): strip Unreal Engine reflection macros before C++ parsing
Tree-sitter does not expand C preprocessor macros, so Unreal Engine reflection markers (UCLASS, UFUNCTION, UPROPERTY, MODULENAME_API, GENERATED_BODY, ...) are parsed verbatim. The result is mis-parsed UE class/function declarations: in 'class BRAWLUI_API UMyClass : public UObject', tree-sitter-cpp captures BRAWLUI_API as the class name, leaving the actual class without an entry in the graph.

This patch adds an optional 'preprocessSource' hook to LanguageProvider and implements it for C++ via a new 'stripUeMacros' module. The transform is length-preserving (each elided byte becomes a space, newlines preserved) so byte offsets and line/column positions tree-sitter reports remain identical to the original file -- symbol locations in the graph stay accurate.

A cheap detection guard short-circuits files that don't look like UE sources, so non-UE C++ codebases pay no cost (single regex test then bail).

27 unit tests cover the detection guard, length preservation across multiple UE samples, macro removal for UCLASS/UFUNCTION/UPROPERTY/USTRUCT/GENERATED_BODY/MODULE_API/DECLARE_*_DELEGATE/UE_DEPRECATED, false-positive guards (substring matches, balanced parens inside string literals, Qt macros left alone), and class-name extraction sanity. Full unit suite still passes (5337 tests, 0 regressions). Verified end-to-end against an Unreal Engine 5.7 game project (Brawl).
2026-05-08 20:56:02 -04:00
..
fixtures feat(go): implement scope resolution hooks for Go language support (#1302) 2026-05-04 07:29:11 +01:00
helpers fix(lbug): robust Windows lock acquisition for CI integration tests (#1430) 2026-05-08 11:58:01 +01:00
integration fix(search): surface warning when FTS indexes are missing (#1418) 2026-05-08 17:05:18 +01:00
unit feat(extractors): strip Unreal Engine reflection macros before C++ parsing 2026-05-08 20:56:02 -04:00
utils ci: add macOS to cross-platform test matrix (#208) 2026-03-07 10:38:32 +00:00